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

allow filtering by response

This commit is contained in:
Ivan Malison
2016-01-11 15:53:04 -08:00
parent 8d5993eced
commit 99d4150df8
2 changed files with 17 additions and 0 deletions

View File

@@ -113,6 +113,21 @@ def test_vcr_before_record_response_iterable():
assert mock_filter.call_count == 1
def test_before_record_response_as_filter():
request = Request('GET', '/', '', {})
response = object() # just can't be None
# Prevent actually saving the cassette
with mock.patch('vcr.cassette.save_cassette'):
filter_all = mock.Mock(return_value=None)
vcr = VCR(before_record_response=filter_all)
with vcr.use_cassette('test') as cassette:
cassette.append(request, response)
assert cassette.data == []e
assert not cassette.dirty
def test_vcr_path_transformer():
# Regression test for #199