Add first work package for REST API implementation
[anna.git] / example / diameter / launcher / resources / rest_api / ct / node-management / node_test.py
diff --git a/example/diameter/launcher/resources/rest_api/ct/node-management/node_test.py b/example/diameter/launcher/resources/rest_api/ct/node-management/node_test.py
new file mode 100644 (file)
index 0000000..b5321c0
--- /dev/null
@@ -0,0 +1,35 @@
+import pytest
+
+
+def test_001_given_node_name_i_want_to_force_it_to_be_set_as_operated_node_at_adml(admlc):
+
+  requestBody = { "name":"afHost.afRealm.com" }
+  responseBodyRef = { "success":"true", "response":"Forced node is now 'afHost.afRealm.com'" }
+
+  # Send POST
+  response = admlc.postDict("/node", requestBody)
+
+  # Verify response
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+def test_002_i_want_to_know_current_operated_node_at_adml(admlc):
+
+  requestBody = { "name":"" }
+
+  # Send POST
+  response = admlc.postDict("/node", requestBody)
+
+  # Verify response is ok (omit response content because it is informative and have dynamic data (timing)):
+  assert response["status"] == 200
+  assert response["body"]["success"] == "true"
+
+def test_001_given_an_invalid_node_name_i_want_to_confirm_the_error_when_trying_to_enable_it_at_adml(admlc):
+
+  requestBody = { "name":"this_does_not_exists" }
+  responseBodyRef = { "success":"true", "response":"Node 'this_does_not_exists' invalid. Nothing done" }
+
+  # Send POST
+  response = admlc.postDict("/node", requestBody)
+
+  # Verify response
+  admlc.assert_response__status_body_headers(response, 200, responseBodyRef)