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

Updated test to use new headers structure

This commit is contained in:
Max Shytikov
2014-04-30 04:05:27 +02:00
parent 65c2797f94
commit 3d2da26933

View File

@@ -16,7 +16,7 @@ def _request_with_auth(url, username, password):
def _find_header(cassette, header):
for request in cassette.requests:
for k, v in request.headers:
for k in request.headers:
if header.lower() == k.lower():
return True
return False
@@ -25,7 +25,7 @@ def _find_header(cassette, header):
def test_filter_basic_auth(tmpdir):
url = 'http://httpbin.org/basic-auth/user/passwd'
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
with my_vcr.use_cassette(cass_file, filter_headers=['authorization']):
with pytest.raises(HTTPError):