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

Add effective url test for httplib2

This commit is contained in:
Maarten van Schaik
2015-08-14 12:37:34 +02:00
parent 01f1f9fdc1
commit 04b5978adc

View File

@@ -56,6 +56,17 @@ def test_response_headers(scheme, tmpdir):
resp, _ = httplib2.Http().request(url)
assert set(headers) == set(resp.items())
def test_effective_url(scheme, tmpdir):
'''Ensure that the effective_url is captured'''
url = scheme + '://httpbin.org/redirect-to?url=/html'
with vcr.use_cassette(str(tmpdir.join('headers.yaml'))) as cass:
resp, _ = httplib2.Http().request(url)
effective_url = resp['content-location']
assert effective_url == scheme + '://httpbin.org/html'
with vcr.use_cassette(str(tmpdir.join('headers.yaml'))) as cass:
resp, _ = httplib2.Http().request(url)
assert effective_url == resp['content-location']
def test_multiple_requests(scheme, tmpdir):
'''Ensure that we can cache multiple requests'''