I have an issue with the test, not sure why?

This commit is contained in:
Rebecca Law
2016-02-17 17:48:23 +00:00
parent 66cf6cfd30
commit 9073814d9f
12 changed files with 142 additions and 35 deletions

View File

@@ -1,10 +1,7 @@
import uuid
import pytest
from app.celery.tasks import (send_sms, send_sms_code)
from app import twilio_client, encryption
from app.clients.sms.twilio import TwilioClientException
from app.celery.tasks import send_sms
from app import firetext_client
from app.celery.tasks import (send_sms, send_sms_code, send_email_code)
from app import (firetext_client, aws_ses_client, encryption)
from app.clients.sms.firetext import FiretextClientException
from app.dao import notifications_dao
from sqlalchemy.exc import SQLAlchemyError
@@ -98,3 +95,20 @@ def test_should_log_firetext_client_exception(mocker):
mocker.patch('app.firetext_client.send_sms', side_effect=FiretextClientException)
send_sms_code(encrypted_notification)
firetext_client.send_sms.assert_called_once_with(notification['to'], notification['secret_code'])
def test_should_send_email_code(mocker):
notification = {'to_address': 'someone@it.gov.uk',
'from_address': 'no-reply@notify.gov.uk',
'subject': 'Verification code',
'body': 11111}
encrypted_notification = encryption.encrypt(notification)
mocker.patch('app.aws_ses_client.send_email')
send_email_code(encrypted_notification)
aws_ses_client.send_email.assert_called_once_with((notification['from_address'],
notification['to_address'],
notification['subject'],
notification['body']))