mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
support allow_redirects option
This commit is contained in:
committed by
Kevin McCarthy
parent
8529c46f00
commit
f387950486
@@ -235,3 +235,21 @@ def test_relative_redirects(tmpdir, scheme, do_request):
|
||||
assert response.json()["url"].endswith("request")
|
||||
|
||||
assert cassette.play_count == 3
|
||||
|
||||
|
||||
def test_redirect_wo_allow_redirects(do_request, yml):
|
||||
url = "https://mockbin.org/redirect/308/5"
|
||||
|
||||
with vcr.use_cassette(yml):
|
||||
response = do_request()("GET", url, allow_redirects=False)
|
||||
|
||||
assert str(response.url).endswith("308/5")
|
||||
assert response.status_code == 308
|
||||
|
||||
with vcr.use_cassette(yml) as cassette:
|
||||
response = do_request()("GET", url, allow_redirects=False)
|
||||
|
||||
assert str(response.url).endswith("308/5")
|
||||
assert response.status_code == 308
|
||||
|
||||
assert cassette.play_count == 1
|
||||
|
||||
Reference in New Issue
Block a user