1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

move httbin_ssl_context fixture into the one place it's used

This commit is contained in:
Thomas Grainger
2024-09-18 22:31:36 +01:00
parent f9d4500c6e
commit e2815fbc88
2 changed files with 14 additions and 16 deletions

View File

@@ -1,4 +1,6 @@
import logging
import os
import ssl
import urllib.parse
import pytest
@@ -12,6 +14,18 @@ aiohttp = pytest.importorskip("aiohttp")
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):
async def wrapper():
return await fn(asyncio.get_running_loop())