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

Default path_transformer=None. Fixes #199

This commit is contained in:
Aron Griffis
2015-08-28 07:25:03 -04:00
parent 083b1ec686
commit 0eda8ba482
5 changed files with 35 additions and 5 deletions

View File

@@ -245,6 +245,13 @@ def test_path_transformer_with_context_manager():
assert cassette._path == 'a'
def test_path_transformer_None():
with Cassette.use(
path='a', path_transformer=None,
) as cassette:
assert cassette._path == 'a'
def test_func_path_generator():
def generator(function):
return os.path.join(os.path.dirname(inspect.getfile(function)),

View File

@@ -98,6 +98,28 @@ def test_vcr_before_record_response_iterable():
assert mock_filter.call_count == 1
def test_vcr_path_transformer():
# Regression test for #199
# Prevent actually saving the cassette
with mock.patch('vcr.cassette.save_cassette'):
# Baseline: path should be unchanged
vcr = VCR()
with vcr.use_cassette('test') as cassette:
assert cassette._path == 'test'
# Regression test: path_transformer=None should do the same.
vcr = VCR(path_transformer=None)
with vcr.use_cassette('test') as cassette:
assert cassette._path == 'test'
# and it should still work with cassette_library_dir
vcr = VCR(cassette_library_dir='/foo')
with vcr.use_cassette('test') as cassette:
assert cassette._path == '/foo/test'
@pytest.fixture
def random_fixture():
return 1