diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 4eb2f61e9..f9ca7861f 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -45,7 +45,7 @@ def send_sms_to_provider(notification): else: try: provider.send_sms( - to=validate_and_format_phone_number(notification.to, internationl=notification.international), + to=validate_and_format_phone_number(notification.to, international=notification.international), content=str(template), reference=str(notification.id), sender=service.sms_sender diff --git a/tests/app/delivery/test_send_to_providers.py b/tests/app/delivery/test_send_to_providers.py index 3965c2af3..0e35ad413 100644 --- a/tests/app/delivery/test_send_to_providers.py +++ b/tests/app/delivery/test_send_to_providers.py @@ -474,7 +474,6 @@ def test_should_update_billable_units_according_to_research_mode_and_key_type(no assert sample_notification.billable_units == billable_units -<<<<<<< HEAD def test_should_send_sms_to_international_providers( restore_provider_details, sample_sms_template_with_html, @@ -529,13 +528,47 @@ def test_should_send_sms_to_international_providers( assert notification_uk.status == 'sending' assert notification_uk.sent_by == 'firetext' - assert notification_int.status == 'sending' + assert notification_int.status == 'sent' assert notification_int.sent_by == 'mmg' -def test_should_send_international_sms_with_formatted_phone_number(): - assert 1 == 2 +def test_should_send_international_sms_with_formatted_phone_number( + notify_db, + sample_template, + mocker +): + notification = create_notification( + template=sample_template, + to_field="+6011-17224412", + international=True + ) + + send_notification_mock = mocker.patch('app.mmg_client.send_sms') + mocker.patch('app.delivery.send_to_providers.send_sms_response') + + send_to_providers.send_sms_to_provider( + notification + ) + + assert send_notification_mock.called is True -def test_should_set_international_phone_number_to_sent_status(): - assert 1 == 2 +def test_should_set_international_phone_number_to_sent_status( + notify_db, + sample_template, + mocker +): + notification = create_notification( + template=sample_template, + to_field="+6011-17224412", + international=True + ) + + mocker.patch('app.mmg_client.send_sms') + mocker.patch('app.delivery.send_to_providers.send_sms_response') + + send_to_providers.send_sms_to_provider( + notification + ) + + assert notification.status == 'sent'