]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Improve test_use_proxy with cassette headers and play_count assertion
authorDanilo Shiga <daniloshiga@gmail.com>
Tue, 18 Sep 2018 13:11:33 +0000 (10:11 -0300)
committerLuiz Menezes <luiz.menezesf@gmail.com>
Tue, 18 Sep 2018 14:06:15 +0000 (11:06 -0300)
tests/integration/test_proxy.py

index 5dfd285e906867e0a0a1ae8f99c04da693c9ee5b..4dfcb92f8af2b542502ca7073bd130b78092a3d0 100644 (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