mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-10 01:25:34 +00:00
Updated test to use new headers structure
This commit is contained in:
@@ -16,7 +16,7 @@ def _request_with_auth(url, username, password):
|
|||||||
|
|
||||||
def _find_header(cassette, header):
|
def _find_header(cassette, header):
|
||||||
for request in cassette.requests:
|
for request in cassette.requests:
|
||||||
for k, v in request.headers:
|
for k in request.headers:
|
||||||
if header.lower() == k.lower():
|
if header.lower() == k.lower():
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@@ -25,7 +25,7 @@ def _find_header(cassette, header):
|
|||||||
def test_filter_basic_auth(tmpdir):
|
def test_filter_basic_auth(tmpdir):
|
||||||
url = 'http://httpbin.org/basic-auth/user/passwd'
|
url = 'http://httpbin.org/basic-auth/user/passwd'
|
||||||
cass_file = str(tmpdir.join('basic_auth_filter.yaml'))
|
cass_file = str(tmpdir.join('basic_auth_filter.yaml'))
|
||||||
my_vcr = vcr.VCR(match_on = ['url', 'method', 'headers'])
|
my_vcr = vcr.VCR(match_on=['uri', 'method', 'headers'])
|
||||||
# 2 requests, one with auth failure and one with auth success
|
# 2 requests, one with auth failure and one with auth success
|
||||||
with my_vcr.use_cassette(cass_file, filter_headers=['authorization']):
|
with my_vcr.use_cassette(cass_file, filter_headers=['authorization']):
|
||||||
with pytest.raises(HTTPError):
|
with pytest.raises(HTTPError):
|
||||||
|
|||||||
Reference in New Issue
Block a user