Improve dynamic test provision
[anna.git] / example / diameter / launcher / resources / rest_api / ct / dynamic-procedure / dynamic_test.py
1 import pytest
2
3
4 @pytest.mark.dynamic
5 @pytest.mark.xfail(reason="This will fail if already provisioned (if you want success here, restart the ADML HTTP Service)")
6 def test_001_given_servicesGx_json_representation_i_want_to_load_it_through_adml_service(resources, admlc):
7
8   # Load services for Gx interface (client/server nodes & Gx dictionary):
9   requestBody = resources("servicesGxJson-request.json")
10   responseBodyRef = { "success":"true", "response":"loaded services correctly" }
11
12   # Send POST
13   response = admlc.post("/services", requestBody)
14
15   ### Verify response
16   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
17
18 @pytest.mark.dynamic
19 def test_002_provision_dynamic_operation_for_gx_at_adml(resources, admlc):
20
21   # Dynamic procedure:
22   requestBody = resources("arguments-request.json")
23   responseBodyRef = { "success":"true", "response":"Completed provision: range [0000, 9000]; scenary: CCR-Initial + CCR-Termination" }
24
25   # Send POST
26   response = admlc.post("/dynamic", requestBody)
27
28   # Verify response
29   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
30
31 @pytest.mark.dynamic
32 def test_003_provision_answers_to_reacts_diameter_client_requests(resources, admlc):
33
34   requestBody = resources("cca-diameterJson-request.json")
35   responseBodyRef = { "success":"true", "response":"Added 'answer to client' to the FIFO queue corresponding to its message code" }
36
37   # Send POST
38   response = admlc.post("/answermsg2c", requestBody)
39
40   ### Verify response
41   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
42
43   # Infinite rotation for the FIFO queue:
44   requestBody = { "action":"rotate" }
45   responseBodyRef = { "success":"true", "response":"rotate" }
46
47   # Send POST
48   response = admlc.postDict("/answermsg2c", requestBody)
49
50   ### Verify response
51   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
52