X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;ds=sidebyside;f=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Ffsm-testing%2Ftest-next_test.py;fp=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Ffsm-testing%2Ftest-next_test.py;h=c9e6abf6affddc7db560434d3442cad169e1077b;hb=080dc0740d8b02011dee032f5d44eeb5f2ffe23f;hp=0000000000000000000000000000000000000000;hpb=c200ffa70e1d93f5cb3137f3542245c44c05b008;p=anna.git diff --git a/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-next_test.py b/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-next_test.py new file mode 100644 index 0000000..c9e6abf --- /dev/null +++ b/example/diameter/launcher/resources/rest_api/ct/fsm-testing/test-next_test.py @@ -0,0 +1,93 @@ +import pytest + + +def test_001_i_want_to_launch_the_next_testcase_with_test_next(admlc, admlf): + + flow = admlf.getId() + + requestBody = { "amount":5 } + responseBodyRef = { "success":"true", "response":"Done" } + + # Send POST + response = admlc.postDict("/testid-ip-limit/{}".format(flow), requestBody) + + ## Launch the next + requestBody = {} # 1 by default + responseBodyRef = { "success":"true", "response":"Processed 1 test case" } + response = admlc.postDict("/test-next", requestBody) + + # Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + + # Cleanup + response = admlc.post("/test-clear") + +def test_002_i_want_to_launch_a_bunch_of_tests_with_test_next(admlc, admlf): + + flow1 = admlf.getId() + flow2 = admlf.getId() + + requestBody = { "amount":5 } + responseBodyRef = { "success":"true", "response":"Done" } + + # Send POSTs + response = admlc.postDict("/testid-ip-limit/{}".format(flow1), requestBody) + response = admlc.postDict("/testid-ip-limit/{}".format(flow2), requestBody) + + ## Launch the second & third: + requestBody = { "syncAmount":2 } + responseBodyRef = { "success":"true", "response":"Processed 2 test cases synchronously" } + response = admlc.postDict("/test-next", requestBody) + + # Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + + # Cleanup + response = admlc.post("/test-clear") + +@pytest.mark.skip(reason="pytest is quite fast and dedicated thread is still running on clear operation, so, clear is not completed") +def test_003_i_want_to_launch_the_next_testcase_with_test_next(admlc, admlf): + + flow = admlf.getId() + + requestBody = { "script":"date +'%s.%N'" } + responseBodyRef = { "success":"true", "response":"Done" } + + # Send POST + response = admlc.postDict("/testid-sh-command/{}".format(flow), requestBody) + + ## Launch the next + requestBody = {} # 1 by default + responseBodyRef = { "success":"true", "response":"Processed 1 test case" } + response = admlc.postDict("/test-next", requestBody) + + # Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + + # Cleanup + response = admlc.post("/test-clear") + +@pytest.mark.skip(reason="pytest is quite fast and dedicated thread is still running on clear operation, so, clear is not completed") +def test_004_i_want_to_launch_a_bunch_of_tests_with_test_next(admlc, admlf): + + flow1 = admlf.getId() + flow2 = admlf.getId() + + requestBody = { "script":"date +'%s.%N'" } + responseBodyRef = { "success":"true", "response":"Done" } + + # Send POSTs + response = admlc.postDict("/testid-sh-command/{}".format(flow1), requestBody) + response = admlc.postDict("/testid-sh-command/{}".format(flow2), requestBody) + + ## Launch the second & third: + requestBody = { "syncAmount":2 } + responseBodyRef = { "success":"true", "response":"Processed 2 test cases synchronously" } + response = admlc.postDict("/test-next", requestBody) + + # Verify response + admlc.assert_response__status_body_headers(response, 200, responseBodyRef) + + # Cleanup + response = admlc.post("/test-clear") +