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

update tests

- Use mockbin for redirections.
- Mock synchronous requests too.
This commit is contained in:
Hernan Ezequiel Di Giorgi
2020-07-18 20:00:55 -03:00
committed by Kevin McCarthy
parent 5afa8f703a
commit 8529c46f00
6 changed files with 40 additions and 63 deletions

View File

@@ -99,7 +99,7 @@ try:
except ImportError: # pragma: no cover
pass
else:
_HttpxClient_send = httpx.Client.send
_HttpxSyncClient_send = httpx.Client.send
_HttpxAsyncClient_send = httpx.AsyncClient.send
@@ -330,11 +330,14 @@ class CassettePatcherBuilder:
except ImportError: # pragma: no cover
return
else:
from .stubs.httpx_stubs import async_vcr_send
from .stubs.httpx_stubs import async_vcr_send, sync_vcr_send
new_async_client_send = async_vcr_send(self._cassette, _HttpxAsyncClient_send)
yield httpx.AsyncClient, "send", new_async_client_send
new_sync_client_send = sync_vcr_send(self._cassette, _HttpxSyncClient_send)
yield httpx.Client, "send", new_sync_client_send
def _urllib3_patchers(self, cpool, stubs):
http_connection_remover = ConnectionRemover(
self._get_cassette_subclass(stubs.VCRRequestsHTTPConnection)