def testGetConvertedVMErrorFlow(self, exc): def _raise_error(*args, **kwargs): raise exc() # we monkeypatch the very first utility function called with MonkeyPatchScope([(v2v, '_get_job', _raise_error)]): # we use uuid to fill the API contract, but it is unused res = v2v.get_converted_vm(str(uuid.uuid4())) self.assertTrue(response.is_error(res))