Added helpers to pytest tests
[anna.git] / example / diameter / launcher / resources / rest_api / ct / helpers / save-node_test.py
diff --git a/example/diameter/launcher/resources/rest_api/ct/helpers/save-node_test.py b/example/diameter/launcher/resources/rest_api/ct/helpers/save-node_test.py
new file mode 100644 (file)
index 0000000..56034cf
--- /dev/null
@@ -0,0 +1,26 @@
+import pytest
+
+@pytest.mark.helpers
+def test_001_save_node(saveB64Artifact, admlc):
+
+  requestBody = { "name":"afHost.afRealm.com" }
+  responseBodyRef = { "success":"true", "response":"Forced node is now 'afHost.afRealm.com'" }
+
+  # Send POST
+  response = admlc.postDict("/node", requestBody)
+
+  # Verify response
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+  requestBody = { "name":"" }
+
+  # Send POST
+  response = admlc.postDict("/node", requestBody)
+
+  # Verify response is ok (omit response content because it is informative and have dynamic data (timing)):
+  assert response["status"] == 200
+  assert response["body"]["success"] == "true"
+
+  # Save artifact from base64 encoded string received
+  saveB64Artifact(response["body"]["response"], "helpers/node")
+