Example #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()
Example #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()
Example #3
0
def mock():
    global mock_request

    mock_request = patch.start()().request
Example #4
0
def setup_module():
    global mock_request

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

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