From 0db39bfac8b01d5a88f8c6022d1eb424d59b9fb8 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Mon, 2 Oct 2017 15:29:13 +0100 Subject: [PATCH] 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. --- tests/app/celery/test_ftp_update_tasks.py | 8 ++++---- tests/app/db.py | 4 ++-- tests/app/delivery/test_send_to_providers.py | 9 +++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/app/celery/test_ftp_update_tasks.py b/tests/app/celery/test_ftp_update_tasks.py index 05680d32b..dc96ac91d 100644 --- a/tests/app/celery/test_ftp_update_tasks.py +++ b/tests/app/celery/test_ftp_update_tasks.py @@ -95,8 +95,8 @@ def test_update_letter_notifications_to_sent_to_dvla_updates_based_on_notificati client, sample_letter_template ): - first = create_notification(sample_letter_template) - second = create_notification(sample_letter_template) + first = create_notification(sample_letter_template, reference='first ref') + second = create_notification(sample_letter_template, reference='second ref') dt = datetime.utcnow() with freeze_time(dt): @@ -113,8 +113,8 @@ def test_update_letter_notifications_to_error_updates_based_on_notification_refe client, sample_letter_template ): - first = create_notification(sample_letter_template) - second = create_notification(sample_letter_template) + first = create_notification(sample_letter_template, reference='first ref') + second = create_notification(sample_letter_template, reference='second ref') dt = datetime.utcnow() with freeze_time(dt): diff --git a/tests/app/db.py b/tests/app/db.py index fdac0f5c4..dfa3f6a07 100644 --- a/tests/app/db.py +++ b/tests/app/db.py @@ -27,8 +27,8 @@ from app.models import ( INBOUND_SMS_TYPE, KEY_TYPE_NORMAL, ServiceInboundApi, - ServiceEmailReplyTo -) + ServiceEmailReplyTo, + ServiceLetterContact, ServiceSmsSender) 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.templates_dao import dao_create_template diff --git a/tests/app/delivery/test_send_to_providers.py b/tests/app/delivery/test_send_to_providers.py index 8f7685f5d..30ca1e876 100644 --- a/tests/app/delivery/test_send_to_providers.py +++ b/tests/app/delivery/test_send_to_providers.py @@ -650,19 +650,20 @@ def test_should_set_international_phone_number_to_sent_status( @pytest.mark.parametrize('sms_sender, expected_sender, expected_content', [ ('foo', 'foo', 'bar'), # 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', 'testing', 'Sample service: bar'), + ('testing', 'testing', 'Sample service: bar'), ]) def test_should_handle_sms_sender_and_prefix_message( mocker, sms_sender, expected_sender, - expected_content + expected_content, + notify_db_session ): mocker.patch('app.mmg_client.send_sms') 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') notification = create_notification(template)