diff options
Diffstat (limited to 'tests/http/test_01_basic.py')
-rw-r--r-- | tests/http/test_01_basic.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/tests/http/test_01_basic.py b/tests/http/test_01_basic.py index 66c9ae50e..30b87007b 100644 --- a/tests/http/test_01_basic.py +++ b/tests/http/test_01_basic.py @@ -46,37 +46,34 @@ class TestBasic: curl = CurlClient(env=env) url = f'http://{env.domain1}:{env.http_port}/data.json' r = curl.http_get(url=url) - r.check_exit_code(0) - assert r.response['status'] == 200 + r.check_response(http_status=200) assert r.json['server'] == env.domain1 # simple https: GET, any http version + @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason=f"curl without SSL") def test_01_02_https_get(self, env: Env, httpd): curl = CurlClient(env=env) url = f'https://{env.domain1}:{env.https_port}/data.json' r = curl.http_get(url=url) - r.check_exit_code(0) - assert r.response['status'] == 200 + r.check_response(http_status=200) assert r.json['server'] == env.domain1 # simple https: GET, h2 wanted and got + @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason=f"curl without SSL") def test_01_03_h2_get(self, env: Env, httpd): curl = CurlClient(env=env) url = f'https://{env.domain1}:{env.https_port}/data.json' r = curl.http_get(url=url, extra_args=['--http2']) - r.check_exit_code(0) - assert r.response['status'] == 200 - assert r.response['protocol'] == 'HTTP/2' + r.check_response(http_status=200, protocol='HTTP/2') assert r.json['server'] == env.domain1 # simple https: GET, h2 unsupported, fallback to h1 + @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason=f"curl without SSL") def test_01_04_h2_unsupported(self, env: Env, httpd): curl = CurlClient(env=env) url = f'https://{env.domain2}:{env.https_port}/data.json' r = curl.http_get(url=url, extra_args=['--http2']) - r.check_exit_code(0) - assert r.response['status'] == 200 - assert r.response['protocol'] == 'HTTP/1.1' + r.check_response(http_status=200, protocol='HTTP/1.1') assert r.json['server'] == env.domain2 # simple h3: GET, want h3 and get it @@ -85,7 +82,5 @@ class TestBasic: curl = CurlClient(env=env) url = f'https://{env.domain1}:{env.h3_port}/data.json' r = curl.http_get(url=url, extra_args=['--http3']) - r.check_exit_code(0) - assert r.response['status'] == 200 - assert r.response['protocol'] == 'HTTP/3' + r.check_response(http_status=200, protocol='HTTP/3') assert r.json['server'] == env.domain1 |