Added --ssl=<PROTOCOL_VERSION>

Closes #98
This commit is contained in:
Jakub Roztocil
2016-03-02 12:12:05 +08:00
parent 38e8ef14ec
commit dc4da527db
6 changed files with 119 additions and 26 deletions

View File

@@ -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):