Add first work package for REST API implementation
[anna.git] / example / diameter / launcher / resources / rest_api / ct / node-management / node_test.py
1 import pytest
2
3
4 def test_001_given_node_name_i_want_to_force_it_to_be_set_as_operated_node_at_adml(admlc):
5
6   requestBody = { "name":"afHost.afRealm.com" }
7   responseBodyRef = { "success":"true", "response":"Forced node is now 'afHost.afRealm.com'" }
8
9   # Send POST
10   response = admlc.postDict("/node", requestBody)
11
12   # Verify response
13   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
14
15 def test_002_i_want_to_know_current_operated_node_at_adml(admlc):
16
17   requestBody = { "name":"" }
18
19   # Send POST
20   response = admlc.postDict("/node", requestBody)
21
22   # Verify response is ok (omit response content because it is informative and have dynamic data (timing)):
23   assert response["status"] == 200
24   assert response["body"]["success"] == "true"
25
26 def test_001_given_an_invalid_node_name_i_want_to_confirm_the_error_when_trying_to_enable_it_at_adml(admlc):
27
28   requestBody = { "name":"this_does_not_exists" }
29   responseBodyRef = { "success":"true", "response":"Node 'this_does_not_exists' invalid. Nothing done" }
30
31   # Send POST
32   response = admlc.postDict("/node", requestBody)
33
34   # Verify response
35   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)