Added helpers to pytest tests
[anna.git] / example / diameter / launcher / resources / rest_api / ct / helpers / save-node_test.py
1 import pytest
2
3 @pytest.mark.helpers
4 def test_001_save_node(saveB64Artifact, admlc):
5
6   requestBody = { "name":"afHost.afRealm.com" }
7   responseBodyRef = { "success":"true", "response":"Forced node is now 'afHost.afRealm.com'" }
8
9   # Send POST
10   response = admlc.postDict("/node", requestBody)
11
12   # Verify response
13   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
14
15   requestBody = { "name":"" }
16
17   # Send POST
18   response = admlc.postDict("/node", requestBody)
19
20   # Verify response is ok (omit response content because it is informative and have dynamic data (timing)):
21   assert response["status"] == 200
22   assert response["body"]["success"] == "true"
23
24   # Save artifact from base64 encoded string received
25   saveB64Artifact(response["body"]["response"], "helpers/node")
26