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)
Esempio n. 2
0
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)
Esempio n. 3
0
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)
Esempio n. 4
0
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)
Esempio n. 5
0
def backfire():
    patch(None, backfire=True)
    yield
    unpatch()
Esempio n. 6
0
 def __enter__(self):
     patch(self.library)