X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Fflow-operations%2Fanswermsg2c_test.py;fp=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Fflow-operations%2Fanswermsg2c_test.py;h=63e7a2103c4eb660e8f2a87f0b7f5e027d938d42;hb=c56124ff93e8bceec159748dfe5ba8d56c62e3de;hp=0000000000000000000000000000000000000000;hpb=220eecc7d53ddb85f72d94d5053738519fd8d27e;p=anna.git diff --git a/example/diameter/launcher/resources/rest_api/ct/flow-operations/answermsg2c_test.py b/example/diameter/launcher/resources/rest_api/ct/flow-operations/answermsg2c_test.py new file mode 100644 index 0000000..63e7a21 --- /dev/null +++ b/example/diameter/launcher/resources/rest_api/ct/flow-operations/answermsg2c_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_client_requests(resources, admlc): + + requestBody = { "name":"ownHostId.operatorRealm.com" } + responseBodyRef = { "success":"true", "response":"Forced node is now 'ownHostId.operatorRealm.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 client' to the FIFO queue corresponding to its message code" } + + # Send POST + response = admlc.post("/answermsg2c", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + +def test_002_i_want_to_list_the_answer_to_client_FIFO_queue(b64_decode, mylogger, admlc): + + requestBody = { "action":"list" } # also empty action is interpreted as "list" + + # Send POST + response = admlc.postDict("/answermsg2c", 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_client_FIFO_queue(admlc): + + requestBody = { "action":"dump" } + responseBodyRef = { "success":"true", "response":"dump" } + + # Send POST + response = admlc.postDict("/answermsg2c", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + +def test_004_i_want_to_clear_the_answer_to_client_FIFO_queue(admlc): + + requestBody = { "action":"clear" } + responseBodyRef = { "success":"true", "response":"clear" } + + # Send POST + response = admlc.postDict("/answermsg2c", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + +def test_005_i_want_to_exhaust_the_answer_to_client_FIFO_queue(admlc): + + requestBody = { "action":"exhaust" } + responseBodyRef = { "success":"true", "response":"exhaust" } + + # Send POST + response = admlc.postDict("/answermsg2c", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + +def test_006_i_want_to_rotate_the_answer_to_client_FIFO_queue(admlc): + + requestBody = { "action":"rotate" } + responseBodyRef = { "success":"true", "response":"rotate" } + + # Send POST + response = admlc.postDict("/answermsg2c", requestBody) + + ### Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) +