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

Add test for urllib2

This commit is contained in:
Maarten van Schaik
2015-08-14 12:42:17 +02:00
parent 04b5978adc
commit ca3200d96e

View File

@@ -49,6 +49,15 @@ def test_response_headers(scheme, tmpdir):
open2 = urlopen(url).info().items()
assert sorted(open1) == sorted(open2)
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:
effective_url = urlopen(url).geturl()
assert effective_url == scheme + '://httpbin.org/html'
with vcr.use_cassette(str(tmpdir.join('headers.yaml'))) as cass:
assert effective_url == urlopen(url).geturl()
def test_multiple_requests(scheme, tmpdir):
'''Ensure that we can cache multiple requests'''