Add fourth work package for REST API implementation
[anna.git] / example / diameter / launcher / resources / rest_api / ct / fsm-testing / test-ttps_test.py
diff --git a/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-ttps_test.py b/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-ttps_test.py
new file mode 100644 (file)
index 0000000..481fccb
--- /dev/null
@@ -0,0 +1,34 @@
+import pytest
+
+
+def test_001_i_want_to_set_a_valid_test_ttps(admlc):
+
+  requestBody = { "amount":5 }
+  responseBodyRef = { "success":"true", "response":"Assigned new test launch rate to 5 events per second" }
+
+  # Send POST
+  response = admlc.postDict("/test-ttps", requestBody)
+
+  # Verify response
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+  # Leave stopped
+  response = admlc.postDict("/test-ttps", { "amount":0 })
+  responseBodyRef = { "success":"true", "response":"Assigned new test launch rate to 0 events per second" }
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+def test_002_i_want_to_set_an_invalid_test_ttps(admlc):
+
+  requestBody = { "amount":-8 }
+  responseBodyRef = { "success":"false", "response":"Internal error (check ADML traces): unable to configure the test rate provided" }
+
+  # Send POST
+  response = admlc.postDict("/test-ttps", requestBody)
+
+  # Verify response
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+  # Leave stopped
+  #response = admlc.postDict("/test-ttps", { "amount":0 })
+  #responseBodyRef = { "success":"true", "response":"Assigned new test launch rate to 0 events per second" }
+  #admlc.assert_response__status_body_headers(response, 200, responseBodyRef)