Stop sending the encrypted message to the send_sms_to_provider task.

Everything the task needs is now stored in the db.
This commit is contained in:
Rebecca Law
2016-06-23 09:41:21 +01:00
parent 02e37dee3a
commit 8f19ad19f8
3 changed files with 10 additions and 15 deletions

View File

@@ -1,20 +1,18 @@
from datetime import datetime
from celery.exceptions import MaxRetriesExceededError
from mock import ANY, call
from notifications_utils.recipients import validate_phone_number, format_phone_number
from app import statsd_client, mmg_client, encryption
from app import statsd_client, mmg_client
from app.celery import provider_tasks
from app.celery.provider_tasks import send_sms_to_provider
from app.celery.research_mode_tasks import send_sms_response
from app.celery.tasks import provider_to_use
from app.clients.sms import SmsClientException
from app.dao import provider_statistics_dao
from datetime import datetime
from freezegun import freeze_time
from app.dao import notifications_dao, provider_details_dao
from notifications_utils.recipients import validate_phone_number, format_phone_number
from app.celery.research_mode_tasks import send_sms_response
from app.dao import provider_statistics_dao
from app.models import Notification, NotificationStatistics, Job
from tests.app.conftest import (
sample_notification
)

View File

@@ -332,8 +332,7 @@ def test_should_send_template_to_correct_sms_task_and_persist(sample_template_wi
provider_tasks.send_sms_to_provider.apply_async.assert_called_once_with(
(sample_template_with_placeholders.service_id,
notification_id,
encryption.encrypt(notification)),
notification_id),
queue="sms"
)
@@ -371,8 +370,7 @@ def test_should_send_sms_if_restricted_service_and_valid_number(notify_db, notif
provider_tasks.send_sms_to_provider.apply_async.assert_called_once_with(
(service.id,
notification_id,
encrypt_notification),
notification_id),
queue="sms"
)
@@ -480,8 +478,7 @@ def test_should_send_sms_template_to_and_persist_with_job_id(sample_job, mocker)
)
provider_tasks.send_sms_to_provider.apply_async.assert_called_once_with(
(sample_job.service.id,
notification_id,
encryption.encrypt(notification)),
notification_id),
queue="sms"
)
persisted_notification = Notification.query.filter_by(id=notification_id).one()