Fix the unit tests.

I think there was some imports missed when resolving merge conflicts.
Also I'm not sure why the test_update_letter_notification_to_sent or error passed, I've updated them so they do pass.
This commit is contained in:
Rebecca Law
2017-10-02 15:29:13 +01:00
parent d5c9174641
commit 0db39bfac8
3 changed files with 11 additions and 10 deletions

View File

@@ -95,8 +95,8 @@ def test_update_letter_notifications_to_sent_to_dvla_updates_based_on_notificati
client, client,
sample_letter_template sample_letter_template
): ):
first = create_notification(sample_letter_template) first = create_notification(sample_letter_template, reference='first ref')
second = create_notification(sample_letter_template) second = create_notification(sample_letter_template, reference='second ref')
dt = datetime.utcnow() dt = datetime.utcnow()
with freeze_time(dt): with freeze_time(dt):
@@ -113,8 +113,8 @@ def test_update_letter_notifications_to_error_updates_based_on_notification_refe
client, client,
sample_letter_template sample_letter_template
): ):
first = create_notification(sample_letter_template) first = create_notification(sample_letter_template, reference='first ref')
second = create_notification(sample_letter_template) second = create_notification(sample_letter_template, reference='second ref')
dt = datetime.utcnow() dt = datetime.utcnow()
with freeze_time(dt): with freeze_time(dt):

View File

@@ -27,8 +27,8 @@ from app.models import (
INBOUND_SMS_TYPE, INBOUND_SMS_TYPE,
KEY_TYPE_NORMAL, KEY_TYPE_NORMAL,
ServiceInboundApi, ServiceInboundApi,
ServiceEmailReplyTo ServiceEmailReplyTo,
) ServiceLetterContact, ServiceSmsSender)
from app.dao.users_dao import save_model_user from app.dao.users_dao import save_model_user
from app.dao.notifications_dao import dao_create_notification, dao_created_scheduled_notification from app.dao.notifications_dao import dao_create_notification, dao_created_scheduled_notification
from app.dao.templates_dao import dao_create_template from app.dao.templates_dao import dao_create_template

View File

@@ -650,19 +650,20 @@ def test_should_set_international_phone_number_to_sent_status(
@pytest.mark.parametrize('sms_sender, expected_sender, expected_content', [ @pytest.mark.parametrize('sms_sender, expected_sender, expected_content', [
('foo', 'foo', 'bar'), ('foo', 'foo', 'bar'),
# if 40604 is actually in DB then treat that as if entered manually # if 40604 is actually in DB then treat that as if entered manually
# ('40604', '40604', 'bar'), ('40604', '40604', 'bar'),
# 'testing' is the FROM_NUMBER during unit tests # 'testing' is the FROM_NUMBER during unit tests
# ('testing', 'testing', 'Sample service: bar'), ('testing', 'testing', 'Sample service: bar'),
]) ])
def test_should_handle_sms_sender_and_prefix_message( def test_should_handle_sms_sender_and_prefix_message(
mocker, mocker,
sms_sender, sms_sender,
expected_sender, expected_sender,
expected_content expected_content,
notify_db_session
): ):
mocker.patch('app.mmg_client.send_sms') mocker.patch('app.mmg_client.send_sms')
mocker.patch('app.delivery.send_to_providers.create_initial_notification_statistic_tasks') mocker.patch('app.delivery.send_to_providers.create_initial_notification_statistic_tasks')
service = create_service(service_name=str(uuid.uuid4()), sms_sender=sms_sender) service = create_service(sms_sender=sms_sender)
template = create_template(service, content='bar') template = create_template(service, content='bar')
notification = create_notification(template) notification = create_notification(template)