Added helpers to pytest tests
[anna.git] / example / diameter / launcher / resources / rest_api / ct / helpers / save-answermsg_test.py
1 import pytest
2
3
4 @pytest.mark.helpers
5 def test_001_save_answermsg2e(saveB64Artifact, admlc):
6
7   requestBody = { "name":"afHost.afRealm.com" }
8   responseBodyRef = { "success":"true", "response":"Forced node is now 'afHost.afRealm.com'" }
9
10   # Send POST
11   response = admlc.postDict("/node", requestBody)
12
13   # Verify response
14   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
15
16   # Send POST
17   response = admlc.postDict("/answermsg2e", { "action":"" })
18
19   # Verify response
20   assert response["status"] == 200
21   assert response["body"]["success"] == "true"
22
23   # Save artifact from base64 encoded string received
24   saveB64Artifact(response["body"]["response"], "helpers/answermsg2e", False) # it is direct text content
25
26 @pytest.mark.helpers
27 def test_002_save_answermsg2c(saveB64Artifact, admlc):
28
29   requestBody = { "name":"ownHostId.operatorRealm.com" }
30   responseBodyRef = { "success":"true", "response":"Forced node is now 'ownHostId.operatorRealm.com'" }
31
32   # Send POST
33   response = admlc.postDict("/node", requestBody)
34
35   # Verify response
36   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
37
38   # Send POST
39   response = admlc.postDict("/answermsg2c", { "action":"" })
40
41   # Verify response
42   assert response["status"] == 200
43   assert response["body"]["success"] == "true"
44
45   # Save artifact from base64 encoded string received
46   saveB64Artifact(response["body"]["response"], "helpers/answermsg2c", False) # it is direct text content