Esempio 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()
Esempio 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()
Esempio n. 3
0
def mock():
    global mock_request

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

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

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