Add fourth work package for REST API implementation
[anna.git] / example / diameter / launcher / resources / rest_api / ct / fsm-testing / test-look_test.py
diff --git a/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-look_test.py b/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-look_test.py
new file mode 100644 (file)
index 0000000..0d2fb9a
--- /dev/null
@@ -0,0 +1,33 @@
+import pytest
+
+
+def test_001_i_want_to_look_an_specific_test(b64_encode, resources, admlc, admlf):
+
+  # Send POST
+  flow = admlf.getId()
+  response = admlc.postDict("/testid-description/{}".format(flow), { "description":"Look test" })
+
+  # Verify response
+  responseBodyRef = { "success":"true", "response":"Done" }
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+  # Send POST
+  response = admlc.postDict("/test-look", { "id":flow })
+
+  # Verify response
+  lookExpected = resources("look_output.txt").format(flow)
+  responseBodyRef = { "success":"true", "response":"{}".format(b64_encode(lookExpected)) }
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+  # Cleanup
+  response = admlc.post("/test-clear")
+
+def test_002_i_want_to_look_an_unexisting_test(admlc):
+
+  # Send POST
+  response = admlc.postDict("/test-look", { "id":666 })
+
+  # Verify response
+  responseBodyRef = { "success":"false", "response":"Internal error (check ADML traces): cannot found test id (666)" }
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+