Add support for sending secure cookies over localhost (#1327)

* Add support for sending secure cookies over localhost

* Refactor

* Fix the CI

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
This commit is contained in:
Batuhan Taskaya
2022-04-14 17:42:05 +03:00
committed by GitHub
parent e6d0bfec7c
commit 86f4bf4d0a
9 changed files with 147 additions and 15 deletions

View File

@@ -7,6 +7,7 @@ from pytest_httpbin import certs
from .utils import ( # noqa
HTTPBIN_WITH_CHUNKED_SUPPORT_DOMAIN,
HTTPBIN_WITH_CHUNKED_SUPPORT,
REMOTE_HTTPBIN_DOMAIN,
mock_env
)
from .utils.plugins_cli import ( # noqa
@@ -17,7 +18,7 @@ from .utils.plugins_cli import ( # noqa
httpie_plugins_success,
interface,
)
from .utils.http_server import http_server # noqa
from .utils.http_server import http_server, localhost_http_server # noqa
@pytest.fixture(scope='function', autouse=True)
@@ -58,6 +59,22 @@ def httpbin_with_chunked_support(_httpbin_with_chunked_support_available):
pytest.skip(f'{HTTPBIN_WITH_CHUNKED_SUPPORT_DOMAIN} not resolvable')
@pytest.fixture(scope='session')
def _remote_httpbin_available():
try:
socket.gethostbyname(REMOTE_HTTPBIN_DOMAIN)
return True
except OSError:
return False
@pytest.fixture
def remote_httpbin(_remote_httpbin_available):
if _remote_httpbin_available:
return 'http://' + REMOTE_HTTPBIN_DOMAIN
pytest.skip(f'{REMOTE_HTTPBIN_DOMAIN} not resolvable')
@pytest.fixture(autouse=True, scope='session')
def pyopenssl_inject():
"""