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

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

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

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