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

Improve test_use_proxy with cassette headers and play_count assertion

This commit is contained in:
Danilo Shiga
2018-09-18 10:11:33 -03:00
committed by Luiz Menezes
parent ff7dd06f47
commit 957db22d5c

View File

@@ -51,5 +51,10 @@ def proxy_server():
def test_use_proxy(tmpdir, httpbin, proxy_server):
'''Ensure that it works with a proxy.'''
with vcr.use_cassette(str(tmpdir.join('proxy.yaml'))):
requests.get(httpbin.url, proxies={'http': proxy_server})
requests.get(httpbin.url, proxies={'http': proxy_server})
response, _ = requests.get(httpbin.url, proxies={'http': proxy_server})
with vcr.use_cassette(str(tmpdir.join('proxy.yaml'))) as cassette:
cassette_response, _ = requests.get(httpbin.url, proxies={'http': proxy_server})
assert cassette_response.headers == response.headers
assert cassette.play_count == 1