Add fourth work package for REST API implementation
[anna.git] / example / diameter / launcher / resources / rest_api / ct / fsm-testing / test-report_test.py
diff --git a/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-report_test.py b/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-report_test.py
new file mode 100644 (file)
index 0000000..b8c09a0
--- /dev/null
@@ -0,0 +1,36 @@
+import pytest
+
+
+def test_001_i_want_to_enable_test_reports_for_any_state(admlc):
+
+  response = admlc.postDict("/test-report", {})
+
+  # Verify response
+  responseBodyRef = { "success":"true", "response":"Report enabled for tests in 'any' state" }
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+def test_002_i_want_to_disable_test_reports_for_any_state(admlc):
+
+  response = admlc.postDict("/test-report", { "action":"disable" })
+
+  # Verify response
+  responseBodyRef = { "success":"true", "response":"Report disabled for tests in 'any' state" }
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+
+def test_003_i_want_to_enable_test_reports_for_failed_state(admlc):
+
+  response = admlc.postDict("/test-report", { "state":"failed" })
+
+  # Verify response
+  responseBodyRef = { "success":"true", "response":"Report enabled for tests in 'failed' state" }
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+def test_004_i_want_to_enable_test_reports_for_invalid_state(admlc):
+
+  response = admlc.postDict("/test-report", { "state":"INVALID STATE" })
+
+  # Verify response
+  responseBodyRef = { "success":"false", "response":"Internal error (check ADML traces): invalid state (allowed: initialized|in-progress|failed|success|[all]|none)" }
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+