X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Ffsm-testing%2Ftest-interact_test.py;fp=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Ffsm-testing%2Ftest-interact_test.py;h=d11086bd9b4c04bc8ab0cce4eb300ea4e7824825;hb=080dc0740d8b02011dee032f5d44eeb5f2ffe23f;hp=0000000000000000000000000000000000000000;hpb=c200ffa70e1d93f5cb3137f3542245c44c05b008;p=anna.git diff --git a/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-interact_test.py b/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-interact_test.py new file mode 100644 index 0000000..d11086b --- /dev/null +++ b/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-interact_test.py @@ -0,0 +1,46 @@ +import pytest + + +def test_001_i_want_to_make_one_test_non_interactive(admlc, admlf): + + # Send POST (test flow with a single step changing ip-limit to 15) + flow = admlf.getId() + response = admlc.postDict("/testid-ip-limit/{}".format(flow), { "amount":15 }) + + # Verify response (test & step programmed) + responseBodyRef = { "success":"true", "response":"Done" } + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + + # Send POST (execute the former test) + response = admlc.postDict("/test-interact", { "amount":-1, "id":flow }) + + # Verify response + responseBodyRef = { "success":"true", "response":"Interactive mode disabled for test case id {}".format(flow) } + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + + # Cleanup & restore ip-limit (at global level because it is easier) + response = admlc.post("/test-clear") + response = admlc.postDict("/test-ip-limit", { "amount":-1 }) + +def test_002_i_want_to_freeze_a_test(admlc, admlf): + + # Send POST (test flow with a single step changing ip-limit to 15) + flow = admlf.getId() + response = admlc.postDict("/testid-ip-limit/{}".format(flow), { "amount":15 }) + + # Verify response (test & step programmed) + responseBodyRef = { "success":"true", "response":"Done" } + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + + # Send POST (execute the former test) + response = admlc.postDict("/test-interact", { "amount":0, "id":flow }) + + # Verify response + respMsg = "Added interactive amount of 0 units (0: freezing a non-interactive testcase, no effect on already interactive) for test case id {}".format(flow) + responseBodyRef = { "success":"true", "response":respMsg } + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + + # Cleanup & restore ip-limit (at global level because it is easier) + response = admlc.post("/test-clear") + response = admlc.postDict("/test-ip-limit", { "amount":-1 }) +