Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_coroutine_mock():
- coro = Mock(name="corutine_result")
- coroutine_function = Mock(
- name="coroutine_function",
- side_effect=coroutine(coro),
- )
- coroutine_function.coro = coro
- return coroutine_function
- class TestCognitoAuthDomainServiceCreateCustomer(TestCase):
- @patch(
- 'cognito.library.identity.AsyncCognito.register',
- new_callable=get_coroutine_mock,
- )
- def test_create_customer__too_many_requests_exception(self, register_mock):
- register_mock.coro.side_effect = Mock(
- side_effect=TooManyRequestsException()
- )
- with self.assertRaises(exceptions.BackendAtCapacityException):
- self._run_helper(
- self.cognito_auth_domain_service.create_customer,
- self.customer,
- self.password,
- )
Advertisement
Add Comment
Please, Sign In to add comment