From 6460030f07d117a83732bbbc0522da3ddc1ae949 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 18 Jul 2019 18:23:15 +0800 Subject: [PATCH] fix: unittests with host debugtalk.com --- tests/httpbin/api/302_redirect.yml | 2 +- tests/test_api.py | 2 +- tests/test_client.py | 4 ++-- tests/test_parser.py | 16 ++++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/httpbin/api/302_redirect.yml b/tests/httpbin/api/302_redirect.yml index 959cc227..5678b158 100644 --- a/tests/httpbin/api/302_redirect.yml +++ b/tests/httpbin/api/302_redirect.yml @@ -3,7 +3,7 @@ name: 302 redirect request: url: https://httpbin.org/redirect-to params: - url: https://debugtalk.com + url: https://github.com status_code: 302 method: GET verify: False diff --git a/tests/test_api.py b/tests/test_api.py index 2f0fa5ce..8479695f 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -424,7 +424,7 @@ class TestHttpRunner(ApiServerUnittest): req_resp_data = summary["details"][0]["records"][0]["meta_datas"]["data"] self.assertEqual(len(req_resp_data), 2) self.assertIn( - "url=https%3A%2F%2Fdebugtalk.com", + "url=https%3A%2F%2Fgithub.com", req_resp_data[0]["request"]["url"] ) diff --git a/tests/test_client.py b/tests/test_client.py index 70d4d276..63ee4bb7 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -70,7 +70,7 @@ class TestHttpClient(ApiServerUnittest): self.assertEqual(resp.request._cookies["b"], "2") def test_request_redirect(self): - url = "{}/redirect-to?url=https%3A%2F%2Fdebugtalk.com&status_code=302".format(HTTPBIN_SERVER) + url = "{}/redirect-to?url=https%3A%2F%2Fgithub.com&status_code=302".format(HTTPBIN_SERVER) headers = {"accept: text/html"} cookies = { "a": "1", @@ -81,6 +81,6 @@ class TestHttpClient(ApiServerUnittest): self.assertEqual(raw_request._cookies["a"], "1") self.assertEqual(raw_request._cookies["b"], "2") redirect_request = resp.request - self.assertEqual(redirect_request.url, "https://debugtalk.com") + self.assertEqual(redirect_request.url, "https://github.com") self.assertEqual(redirect_request._cookies["a"], "1") self.assertEqual(redirect_request._cookies["b"], "2") diff --git a/tests/test_parser.py b/tests/test_parser.py index 69147c50..5391ebc2 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -944,7 +944,7 @@ class TestParser(unittest.TestCase): 'name': '', "base_url": "$host", 'variables': { - "host": "https://debugtalk.com" + "host": "https://github.com" }, "verify": False }, @@ -971,7 +971,7 @@ class TestParser(unittest.TestCase): 'name': '', "base_url": "$host1", 'variables': { - "host1": "https://debugtalk.com" + "host1": "https://github.com" } }, "teststeps": [ @@ -1000,7 +1000,7 @@ class TestParser(unittest.TestCase): 'name': '', "base_url": "$host1", 'variables': { - "host1": "https://debugtalk.com" + "host1": "https://github.com" } }, "teststeps": [ @@ -1035,7 +1035,7 @@ class TestParser(unittest.TestCase): 'name': '', "base_url": "$host1", 'variables': { - "host1": "https://debugtalk.com", + "host1": "https://github.com", "var_a": "${gen_random_string(5)}", "var_b": "$var_a" } @@ -1087,7 +1087,7 @@ class TestParser(unittest.TestCase): 'name': '', "base_url": "$host1", 'variables': { - "host1": "https://debugtalk.com" + "host1": "https://github.com" } }, "teststeps": [ @@ -1123,7 +1123,7 @@ class TestParser(unittest.TestCase): 'name': '', "base_url": "$host", 'variables': { - "host": "https://debugtalk.com" + "host": "https://github.com" }, "verify": False }, @@ -1277,7 +1277,7 @@ class TestParser(unittest.TestCase): loader.load_project_tests(os.path.join(os.getcwd(), "tests")) raw_testinfo = { "name": "get token", - "base_url": "https://debugtalk.com", + "base_url": "https://github.com", "api": "api/get_token.yml", } api_def_dict = loader.load_teststep(raw_testinfo) @@ -1301,7 +1301,7 @@ class TestParser(unittest.TestCase): } parser._extend_with_api(test_block, api_def_dict) - self.assertEqual(test_block["base_url"], "https://debugtalk.com") + self.assertEqual(test_block["base_url"], "https://github.com") self.assertEqual(test_block["name"], "override block") self.assertEqual({'var': 123}, test_block["variables"]) self.assertIn({'check': 'status_code', 'expect': 201, 'comparator': 'equals'}, test_block["validate"])