mirror of
https://github.com/httpie/cli.git
synced 2025-06-26 04:21:24 +02:00
Skip on pyOpenSSL (#1376)
This commit is contained in:
parent
79a8ecd84b
commit
419cc2c34a
@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -8,6 +7,7 @@ from .utils import ( # noqa
|
|||||||
HTTPBIN_WITH_CHUNKED_SUPPORT_DOMAIN,
|
HTTPBIN_WITH_CHUNKED_SUPPORT_DOMAIN,
|
||||||
HTTPBIN_WITH_CHUNKED_SUPPORT,
|
HTTPBIN_WITH_CHUNKED_SUPPORT,
|
||||||
REMOTE_HTTPBIN_DOMAIN,
|
REMOTE_HTTPBIN_DOMAIN,
|
||||||
|
IS_PYOPENSSL,
|
||||||
mock_env
|
mock_env
|
||||||
)
|
)
|
||||||
from .utils.plugins_cli import ( # noqa
|
from .utils.plugins_cli import ( # noqa
|
||||||
@ -81,7 +81,7 @@ def pyopenssl_inject():
|
|||||||
Injects `pyOpenSSL` module to make sure `requests` will use it.
|
Injects `pyOpenSSL` module to make sure `requests` will use it.
|
||||||
<https://github.com/psf/requests/pull/5443#issuecomment-645740394>
|
<https://github.com/psf/requests/pull/5443#issuecomment-645740394>
|
||||||
"""
|
"""
|
||||||
if os.getenv('HTTPIE_TEST_WITH_PYOPENSSL', '0') == '1':
|
if IS_PYOPENSSL:
|
||||||
try:
|
try:
|
||||||
import urllib3.contrib.pyopenssl
|
import urllib3.contrib.pyopenssl
|
||||||
urllib3.contrib.pyopenssl.inject_into_urllib3()
|
urllib3.contrib.pyopenssl.inject_into_urllib3()
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
import ssl
|
import ssl
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -11,7 +10,7 @@ from unittest import mock
|
|||||||
from httpie.ssl_ import AVAILABLE_SSL_VERSION_ARG_MAPPING, DEFAULT_SSL_CIPHERS
|
from httpie.ssl_ import AVAILABLE_SSL_VERSION_ARG_MAPPING, DEFAULT_SSL_CIPHERS
|
||||||
from httpie.status import ExitStatus
|
from httpie.status import ExitStatus
|
||||||
|
|
||||||
from .utils import HTTP_OK, TESTS_ROOT, http
|
from .utils import HTTP_OK, TESTS_ROOT, IS_PYOPENSSL, http
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -152,6 +151,7 @@ def test_ciphers(httpbin_secure):
|
|||||||
assert HTTP_OK in r
|
assert HTTP_OK in r
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(IS_PYOPENSSL, reason='pyOpenSSL uses a different message format.')
|
||||||
def test_ciphers_none_can_be_selected(httpbin_secure):
|
def test_ciphers_none_can_be_selected(httpbin_secure):
|
||||||
r = http(
|
r = http(
|
||||||
httpbin_secure.url + '/get',
|
httpbin_secure.url + '/get',
|
||||||
@ -169,8 +169,7 @@ def test_ciphers_none_can_be_selected(httpbin_secure):
|
|||||||
|
|
||||||
|
|
||||||
def test_pyopenssl_presence():
|
def test_pyopenssl_presence():
|
||||||
using_pyopenssl = os.getenv('HTTPIE_TEST_WITH_PYOPENSSL', '0')
|
if not IS_PYOPENSSL:
|
||||||
if using_pyopenssl == '0':
|
|
||||||
assert not urllib3.util.ssl_.IS_PYOPENSSL
|
assert not urllib3.util.ssl_.IS_PYOPENSSL
|
||||||
assert not urllib3.util.IS_PYOPENSSL
|
assert not urllib3.util.IS_PYOPENSSL
|
||||||
else:
|
else:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Utilities for HTTPie test suite."""
|
"""Utilities for HTTPie test suite."""
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
@ -30,6 +31,7 @@ REMOTE_HTTPBIN_DOMAIN = 'pie.dev'
|
|||||||
HTTPBIN_WITH_CHUNKED_SUPPORT_DOMAIN = 'pie.dev'
|
HTTPBIN_WITH_CHUNKED_SUPPORT_DOMAIN = 'pie.dev'
|
||||||
HTTPBIN_WITH_CHUNKED_SUPPORT = 'http://' + HTTPBIN_WITH_CHUNKED_SUPPORT_DOMAIN
|
HTTPBIN_WITH_CHUNKED_SUPPORT = 'http://' + HTTPBIN_WITH_CHUNKED_SUPPORT_DOMAIN
|
||||||
|
|
||||||
|
IS_PYOPENSSL = os.getenv('HTTPIE_TEST_WITH_PYOPENSSL', '0') == '1'
|
||||||
|
|
||||||
TESTS_ROOT = Path(__file__).parent.parent
|
TESTS_ROOT = Path(__file__).parent.parent
|
||||||
CRLF = '\r\n'
|
CRLF = '\r\n'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user