Add fourth work package for REST API implementation
[anna.git] / example / diameter / launcher / resources / rest_api / ct / fsm-testing / test-state_test.py
diff --git a/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-state_test.py b/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-state_test.py
new file mode 100644 (file)
index 0000000..f2332f2
--- /dev/null
@@ -0,0 +1,32 @@
+import pytest
+
+
+def test_001_i_want_to_get_the_state_for_specific_test(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-state", { "id":flow })
+
+  # Verify response
+  responseBodyRef = { "success":"false", "response":"Initialized" } # success is false, because test-state returns true when test is Success.
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+  # Cleanup
+  response = admlc.post("/test-clear")
+
+def test_002_i_want_to_get_the_state_for_unexisting_test(admlc):
+
+  # Send POST
+  response = admlc.postDict("/test-state", { "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)
+