mirror of
https://github.com/curl/curl.git
synced 2026-07-24 01:47:20 +03:00
pytest: improvements for suitable curl and error output
- will check built curl for http and https support and skip all tests if not there - will dump stdout/stderr/trace output on errored responses Closes #10829
This commit is contained in:
parent
8455013359
commit
8cabef6fc3
16 changed files with 131 additions and 106 deletions
|
|
@ -34,8 +34,6 @@ from testenv import CurlClient
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.mark.skipif(condition=Env.setup_incomplete(),
|
||||
reason=f"missing: {Env.incomplete_reason()}")
|
||||
class TestBasic:
|
||||
|
||||
@pytest.fixture(autouse=True, scope='class')
|
||||
|
|
@ -48,7 +46,7 @@ class TestBasic:
|
|||
curl = CurlClient(env=env)
|
||||
url = f'http://{env.domain1}:{env.http_port}/data.json'
|
||||
r = curl.http_get(url=url)
|
||||
assert r.exit_code == 0
|
||||
r.check_exit_code(0)
|
||||
assert r.response['status'] == 200
|
||||
assert r.json['server'] == env.domain1
|
||||
|
||||
|
|
@ -57,7 +55,7 @@ class TestBasic:
|
|||
curl = CurlClient(env=env)
|
||||
url = f'https://{env.domain1}:{env.https_port}/data.json'
|
||||
r = curl.http_get(url=url)
|
||||
assert r.exit_code == 0
|
||||
r.check_exit_code(0)
|
||||
assert r.response['status'] == 200
|
||||
assert r.json['server'] == env.domain1
|
||||
|
||||
|
|
@ -66,7 +64,7 @@ class TestBasic:
|
|||
curl = CurlClient(env=env)
|
||||
url = f'https://{env.domain1}:{env.https_port}/data.json'
|
||||
r = curl.http_get(url=url, extra_args=['--http2'])
|
||||
assert r.exit_code == 0
|
||||
r.check_exit_code(0)
|
||||
assert r.response['status'] == 200
|
||||
assert r.response['protocol'] == 'HTTP/2'
|
||||
assert r.json['server'] == env.domain1
|
||||
|
|
@ -76,7 +74,7 @@ class TestBasic:
|
|||
curl = CurlClient(env=env)
|
||||
url = f'https://{env.domain2}:{env.https_port}/data.json'
|
||||
r = curl.http_get(url=url, extra_args=['--http2'])
|
||||
assert r.exit_code == 0
|
||||
r.check_exit_code(0)
|
||||
assert r.response['status'] == 200
|
||||
assert r.response['protocol'] == 'HTTP/1.1'
|
||||
assert r.json['server'] == env.domain2
|
||||
|
|
@ -87,7 +85,7 @@ 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'])
|
||||
assert r.exit_code == 0, f'{r}'
|
||||
r.check_exit_code(0)
|
||||
assert r.response['status'] == 200
|
||||
assert r.response['protocol'] == 'HTTP/3'
|
||||
assert r.json['server'] == env.domain1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue