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

Make cassette active for duration of coroutine/generator

Closes #177.
This commit is contained in:
Ivan Malison
2015-07-30 01:47:29 -07:00
parent 4fb5bef8e1
commit 21c176ee1e
5 changed files with 138 additions and 29 deletions

View File

@@ -23,7 +23,7 @@ class VCR(object):
return path
return ensure
def __init__(self, path_transformer=lambda x: x, before_record_request=None,
def __init__(self, path_transformer=None, before_record_request=None,
custom_patches=(), filter_query_parameters=(), ignore_hosts=(),
record_mode="once", ignore_localhost=False, filter_headers=(),
before_record_response=None, filter_post_data_parameters=(),
@@ -59,7 +59,7 @@ class VCR(object):
self.ignore_hosts = ignore_hosts
self.ignore_localhost = ignore_localhost
self.inject_cassette = inject_cassette
self.path_transformer = path_transformer
self.path_transformer = path_transformer or self.ensure_suffix('.yaml')
self.func_path_generator = func_path_generator
self._custom_patches = tuple(custom_patches)
@@ -107,7 +107,7 @@ class VCR(object):
matcher_names = kwargs.get('match_on', self.match_on)
path_transformer = kwargs.get(
'path_transformer',
self.path_transformer
self.path_transformer or self.ensure_suffix('.yaml')
)
func_path_generator = kwargs.get(
'func_path_generator',