def unpatched_httplib_context(cassette_library): """Create a context in which httplib is unpatched.""" from cassette.patcher import patch, unpatch unpatch() yield patch(cassette_library)
def insert(filename): """Setup cassette. :param filename: path to .yaml where requests and responses will be stored. """ global cassette_library cassette_library = CassetteLibrary(filename) patch(cassette_library)
def insert(filename, file_format=''): """Setup cassette. :param filename: path to where requests and responses will be stored. """ global cassette_library cassette_library = CassetteLibrary.create_new_cassette_library( filename, file_format) patch(cassette_library)
def insert(filename, file_format=''): """Setup cassette. :param filename: path to where requests and responses will be stored. """ global cassette_library cassette_library = CassetteLibrary.create_new_cassette_library( filename, file_format) patch(cassette_library)
def backfire(): patch(None, backfire=True) yield unpatch()
def __enter__(self): patch(self.library)