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

Remove instance variables for filter_headers, filter_query_params, ignore_localhost and ignore_hosts. These still exist on the VCR object, but they are automatically translated into a filter function when passed to the cassette.

This commit is contained in:
Ivan Malison
2014-09-22 17:57:22 -07:00
parent d484dee50f
commit 0871c3b87c
8 changed files with 161 additions and 113 deletions

View File

@@ -54,15 +54,20 @@ def test_filter_querystring(tmpdir):
urlopen(url)
assert 'foo' not in cass.requests[0].url
def test_filter_callback(tmpdir):
url = 'http://httpbin.org/get'
cass_file = str(tmpdir.join('basic_auth_filter.yaml'))
def before_record_cb(request):
if request.path != '/get':
return request
my_vcr = vcr.VCR(
before_record = before_record_cb,
)
# Test the legacy keyword.
my_vcr = vcr.VCR(before_record=before_record_cb)
with my_vcr.use_cassette(cass_file, filter_headers=['authorization']) as cass:
urlopen(url)
assert len(cass) == 0
my_vcr = vcr.VCR(before_record_request=before_record_cb)
with my_vcr.use_cassette(cass_file, filter_headers=['authorization']) as cass:
urlopen(url)
assert len(cass) == 0