mirror of
https://github.com/httpie/cli.git
synced 2025-08-19 03:17:44 +02:00
@@ -5,6 +5,7 @@ import pytest_httpbin.certs
|
||||
from requests.exceptions import SSLError
|
||||
|
||||
from httpie import ExitStatus
|
||||
from httpie.input import SSL_VERSION_ARG_MAPPING
|
||||
from utils import http, HTTP_OK, TESTS_ROOT
|
||||
|
||||
|
||||
@@ -18,6 +19,26 @@ CLIENT_PEM = os.path.join(TESTS_ROOT, 'client_certs', 'client.pem')
|
||||
CA_BUNDLE = pytest_httpbin.certs.where()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
argnames='ssl_version',
|
||||
argvalues=SSL_VERSION_ARG_MAPPING.keys()
|
||||
)
|
||||
def test_ssl_version(httpbin_secure, ssl_version):
|
||||
try:
|
||||
r = http(
|
||||
'--verify', CA_BUNDLE,
|
||||
'--ssl', ssl_version,
|
||||
httpbin_secure + '/get'
|
||||
)
|
||||
assert HTTP_OK in r
|
||||
except SSLError as e:
|
||||
if ssl_version == 'ssl3':
|
||||
# pytest-httpbin doesn't support ssl3
|
||||
assert 'SSLV3_ALERT_HANDSHAKE_FAILURE' in str(e)
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
class TestClientCert:
|
||||
|
||||
def test_cert_and_key(self, httpbin_secure):
|
||||
|
Reference in New Issue
Block a user