mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 17:15:35 +00:00
move httbin_ssl_context fixture into the one place it's used
This commit is contained in:
@@ -1,16 +0,0 @@
|
|||||||
import os
|
|
||||||
import ssl
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def httpbin_ssl_context():
|
|
||||||
ssl_ca_location = os.environ["REQUESTS_CA_BUNDLE"]
|
|
||||||
ssl_cert_location = os.environ["REQUESTS_CA_BUNDLE"].replace("cacert.pem", "cert.pem")
|
|
||||||
ssl_key_location = os.environ["REQUESTS_CA_BUNDLE"].replace("cacert.pem", "key.pem")
|
|
||||||
|
|
||||||
ssl_context = ssl.create_default_context(cafile=ssl_ca_location)
|
|
||||||
ssl_context.load_cert_chain(ssl_cert_location, ssl_key_location)
|
|
||||||
|
|
||||||
return ssl_context
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import ssl
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@@ -12,6 +14,18 @@ aiohttp = pytest.importorskip("aiohttp")
|
|||||||
from .aiohttp_utils import aiohttp_app, aiohttp_request # noqa: E402
|
from .aiohttp_utils import aiohttp_app, aiohttp_request # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def httpbin_ssl_context():
|
||||||
|
ssl_ca_location = os.environ["REQUESTS_CA_BUNDLE"]
|
||||||
|
ssl_cert_location = os.environ["REQUESTS_CA_BUNDLE"].replace("cacert.pem", "cert.pem")
|
||||||
|
ssl_key_location = os.environ["REQUESTS_CA_BUNDLE"].replace("cacert.pem", "key.pem")
|
||||||
|
|
||||||
|
ssl_context = ssl.create_default_context(cafile=ssl_ca_location)
|
||||||
|
ssl_context.load_cert_chain(ssl_cert_location, ssl_key_location)
|
||||||
|
|
||||||
|
return ssl_context
|
||||||
|
|
||||||
|
|
||||||
def run_in_loop(fn):
|
def run_in_loop(fn):
|
||||||
async def wrapper():
|
async def wrapper():
|
||||||
return await fn(asyncio.get_running_loop())
|
return await fn(asyncio.get_running_loop())
|
||||||
|
|||||||
Reference in New Issue
Block a user