Exemplo n.º 1
0
 def __enter__(self):
     """
     Starts all patched objects using 'with' context management.
     Does not return anything for 'as' keyword.
     """
     for patch in self.patch_objects:
         patch.start()
Exemplo n.º 2
0
def setup_module():
    global mock_request
    global response

    mock_request = patch.start()
    mock_request = mock_request()
    mock_request = mock_request.request
    mock_request.return_value = response = mock()
Exemplo n.º 3
0
def mock():
    global mock_request

    mock_request = patch.start()().request
Exemplo n.º 4
0
def setup_module():
    global mock_request

    mock_request = patch.start()().request
Exemplo n.º 5
0
 def __enter__(self):
     for patch in self.settings_patches:
         patch.start()
     self.patcher.start().return_value = self.return_value
Exemplo n.º 6
0
def mock():
    global mock_request

    mock_request = patch.start()().request
Exemplo n.º 7
0
 def __enter__(self):
     for patch in self.settings_patches:
         patch.start()
     self.patcher.start().return_value = self.return_value
Exemplo n.º 8
0
 def install(patch):
     patch.start()
     self.addCleanup(patch.stop)
Exemplo n.º 9
0
 def apply_patch(self, patch):
     obj = patch.start()
     self.addCleanup(patch.stop)
     return obj
Exemplo n.º 10
0
 def apply_patch(self, patch):
     obj = patch.start()
     self.addCleanup(patch.stop)
     return obj