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