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

Fix urllib redirect tests

This commit is contained in:
Jair Henrique
2021-11-02 16:15:04 -03:00
parent 3c7b791783
commit cd72278062
2 changed files with 10 additions and 7 deletions

View File

@@ -56,12 +56,13 @@ def test_response_headers(httpbin_both, tmpdir):
assert sorted(open1) == sorted(open2)
def test_effective_url(httpbin_both, tmpdir):
def test_effective_url(tmpdir):
"""Ensure that the effective_url is captured"""
url = httpbin_both.url + "/redirect-to?url=/html"
url = "http://mockbin.org/redirect/301"
with vcr.use_cassette(str(tmpdir.join("headers.yaml"))):
effective_url = urlopen_with_cafile(url).geturl()
assert effective_url == httpbin_both.url + "/html"
assert effective_url == "http://mockbin.org/redirect/301/0"
with vcr.use_cassette(str(tmpdir.join("headers.yaml"))):
assert effective_url == urlopen_with_cafile(url).geturl()