X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Fflow-operations%2Fanswermsg2e_test.py;fp=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Fflow-operations%2Fanswermsg2e_test.py;h=6f97b8447f2f5d4b8454d8200b8c1cc92833e7a4;hb=c56124ff93e8bceec159748dfe5ba8d56c62e3de;hp=0000000000000000000000000000000000000000;hpb=220eecc7d53ddb85f72d94d5053738519fd8d27e;p=anna.git diff --git a/example/diameter/launcher/resources/rest_api/ct/flow-operations/answermsg2e_test.py b/example/diameter/launcher/resources/rest_api/ct/flow-operations/answermsg2e_test.py new file mode 100644 index 0000000..6f97b84 --- /dev/null +++ b/example/diameter/launcher/resources/rest_api/ct/flow-operations/answermsg2e_test.py @@ -0,0 +1,80 @@ +import pytest + + +def test_001_given_diameter_answer_json_representation_i_want_to_provision_it_to_reacts_to_diameter_entity_requests(resources, 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) + + requestBody = resources("aaa-diameterJson-request.json") + responseBodyRef = { "success":"true", "response":"Added 'answer to entity' to the FIFO queue corresponding to its message code" } + + # Send POST + response = admlc.post("/answermsg2e", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + +def test_002_i_want_to_list_the_answer_to_entity_FIFO_queue(b64_decode, mylogger, admlc): + + requestBody = { "action":"list" } # also empty action is interpreted as "list" + + # Send POST + response = admlc.postDict("/answermsg2e", requestBody) + + # Verify response is ok (omit response content because it is dynamic: will be logged) + assert response["status"] == 200 + assert response["body"]["success"] == "true" + body_response = b64_decode(response["body"]["response"]) + mylogger.info("\nBASE64 DECODED RESPONSE: \n\n" + body_response) + +def test_003_i_want_to_dump_the_answer_to_entity_FIFO_queue(admlc): + + requestBody = { "action":"dump" } + responseBodyRef = { "success":"true", "response":"dump" } + + # Send POST + response = admlc.postDict("/answermsg2e", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + +def test_004_i_want_to_clear_the_answer_to_entity_FIFO_queue(admlc): + + requestBody = { "action":"clear" } + responseBodyRef = { "success":"true", "response":"clear" } + + # Send POST + response = admlc.postDict("/answermsg2e", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + +def test_005_i_want_to_exhaust_the_answer_to_entity_FIFO_queue(admlc): + + requestBody = { "action":"exhaust" } + responseBodyRef = { "success":"true", "response":"exhaust" } + + # Send POST + response = admlc.postDict("/answermsg2e", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + +def test_006_i_want_to_rotate_the_answer_to_entity_FIFO_queue(admlc): + + requestBody = { "action":"rotate" } + responseBodyRef = { "success":"true", "response":"rotate" } + + # Send POST + response = admlc.postDict("/answermsg2e", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) +