Add fourth work package for REST API implementation
[anna.git] / example / diameter / launcher / resources / rest_api / ct / fsm-testing / test-state_test.py
1 import pytest
2
3
4 def test_001_i_want_to_get_the_state_for_specific_test(admlc, admlf):
5
6   # Send POST
7   flow = admlf.getId()
8   response = admlc.postDict("/testid-description/{}".format(flow), { "description":"Look test" })
9
10   # Verify response
11   responseBodyRef = { "success":"true", "response":"Done" }
12   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
13
14   # Send POST
15   response = admlc.postDict("/test-state", { "id":flow })
16
17   # Verify response
18   responseBodyRef = { "success":"false", "response":"Initialized" } # success is false, because test-state returns true when test is Success.
19   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
20
21   # Cleanup
22   response = admlc.post("/test-clear")
23
24 def test_002_i_want_to_get_the_state_for_unexisting_test(admlc):
25
26   # Send POST
27   response = admlc.postDict("/test-state", { "id":666 })
28
29   # Verify response
30   responseBodyRef = { "success":"false", "response":"Internal error (check ADML traces): cannot found test id (666)" }
31   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
32