def test_email_sent_when_all_provider_unavailable(): emails_handler = EmailsHandler( MockUsersDao(), MockEmailsDao(), [BadMockEmailsProvider(), BadMockEmailsProvider()]) event = assemble_request("/email/1/send", method="POST", headers={"api_key": "test_api_key"}, path_params={"email_id": 1}) response = wrap_event(emails_handler.handle_send_email, event) code = response.status_code assert code is not None and code == 400
def test_email_sent_when_one_provider_unavailable(): emails_handler = EmailsHandler( MockUsersDao(), MockEmailsDao(), [BadMockEmailsProvider(), SimpleMockEmailsProvider()]) event = assemble_request("/email/1/send", method="POST", headers={"api_key": "test_api_key"}, path_params={"email_id": 1}) response = wrap_event(emails_handler.handle_send_email, event) code = response.status_code assert code is not None and code == 200 email = json.loads(response.body) assert email.get("id") is not None assert email.get("status") is not None and email.get( "status") == EmailStatus.ACCEPTED.name
def sparkpsot_receive(event): return wrap_event(sparkpsot_receiver.handle, event)
def mailgun_receive(event): return wrap_event(mailgun_receiver_handler.handle, event)
def email_send(event): return wrap_event(emails_handler.handle_send_email, event)
def email_get(event): return wrap_event(emails_handler.handle_get_email, event)
def email_sent(event, **kwargs): return wrap_event(emails_handler.handle_create_email, event)
def swagger_doc(event, **kwargs): return wrap_event(api_doc_handler.handle, event)