Add fourth work package for REST API implementation
[anna.git] / example / diameter / launcher / resources / rest_api / ct / fsm-testing / test-look_test.py
1 import pytest
2
3
4 def test_001_i_want_to_look_an_specific_test(b64_encode, resources, 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-look", { "id":flow })
16
17   # Verify response
18   lookExpected = resources("look_output.txt").format(flow)
19   responseBodyRef = { "success":"true", "response":"{}".format(b64_encode(lookExpected)) }
20   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
21
22   # Cleanup
23   response = admlc.post("/test-clear")
24
25 def test_002_i_want_to_look_an_unexisting_test(admlc):
26
27   # Send POST
28   response = admlc.postDict("/test-look", { "id":666 })
29
30   # Verify response
31   responseBodyRef = { "success":"false", "response":"Internal error (check ADML traces): cannot found test id (666)" }
32   admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
33