Added helpers to pytest tests
[anna.git] / example / diameter / launcher / resources / rest_api / ct / helpers / save-loadmsg_test.py
diff --git a/example/diameter/launcher/resources/rest_api/ct/helpers/save-loadmsg_test.py b/example/diameter/launcher/resources/rest_api/ct/helpers/save-loadmsg_test.py
new file mode 100644 (file)
index 0000000..3a89500
--- /dev/null
@@ -0,0 +1,20 @@
+import pytest
+
+
+@pytest.mark.helpers
+def test_001_save_msg_loaded(saveB64Artifact, b64_encode, resources, admlc):
+
+  requestBody = resources("aar-diameterJson-request.json")
+
+  # reponse field in response body, should carry the base64 encoding for xml message loaded by ADML:
+  xmlExpected = resources("aar.xml")
+  responseBodyRef = { "success":"true", "response":"{}".format(b64_encode(xmlExpected)) }
+
+  # Send POST
+  response = admlc.post("/loadmsg", requestBody)
+
+  ### Verify response
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+  # Save artifact from base64 encoded string received
+  saveB64Artifact(response["body"]["response"], "helpers/loadmsg")