Fixed build

- passing a single param to a celery task must be done as a list not a tuple.
This commit is contained in:
Martyn Inglis
2016-09-30 13:34:44 +01:00
parent f7242e007e
commit ad5222442a
4 changed files with 26 additions and 26 deletions

View File

@@ -131,7 +131,7 @@ def send_sms(self,
)
)
provider_tasks.deliver_sms.apply_async(
(notification_id),
[notification_id],
queue='send-sms' if not service.research_mode else 'research-mode'
)
@@ -173,7 +173,7 @@ def send_email(self, service_id,
)
provider_tasks.deliver_email.apply_async(
(notification_id),
[notification_id],
queue='send-email' if not service.research_mode else 'research-mode'
)

View File

@@ -335,12 +335,12 @@ def persist_notification(
research_mode = service.research_mode or key_type == KEY_TYPE_TEST
if notification_type == SMS_TYPE:
provider_tasks.deliver_sms.apply_async(
(str(notification_id)),
[str(notification_id)],
queue='send-sms' if not research_mode else 'research-mode'
)
if notification_type == EMAIL_TYPE:
provider_tasks.deliver_email.apply_async(
(str(notification_id)),
[str(notification_id)],
queue='send-email' if not research_mode else 'research-mode'
)
except Exception as e:

View File

@@ -337,7 +337,7 @@ def test_should_send_template_to_correct_sms_task_and_persist(sample_template_wi
)
provider_tasks.deliver_sms.apply_async.assert_called_once_with(
(notification_id),
[notification_id],
queue="send-sms"
)
@@ -377,7 +377,7 @@ def test_should_put_send_sms_task_in_research_mode_queue_if_research_mode_servic
)
provider_tasks.deliver_sms.apply_async.assert_called_once_with(
(notification_id),
[notification_id],
queue="research-mode"
)
@@ -400,7 +400,7 @@ def test_should_send_sms_if_restricted_service_and_valid_number(notify_db, notif
)
provider_tasks.deliver_sms.apply_async.assert_called_once_with(
(notification_id),
[notification_id],
queue="send-sms"
)
@@ -438,7 +438,7 @@ def test_should_not_send_sms_if_restricted_service_and_invalid_number_with_test_
)
provider_tasks.deliver_sms.apply_async.assert_called_once_with(
(notification_id),
[notification_id],
queue="send-sms"
)
@@ -468,7 +468,7 @@ def test_should_not_send_email_if_restricted_service_and_invalid_email_address_w
)
provider_tasks.deliver_email.apply_async.assert_called_once_with(
(notification_id),
[notification_id],
queue="send-email"
)
@@ -539,7 +539,7 @@ def test_should_put_send_email_task_in_research_mode_queue_if_research_mode_serv
)
provider_tasks.deliver_email.apply_async.assert_called_once_with(
(notification_id),
[notification_id],
queue="research-mode"
)
@@ -562,7 +562,7 @@ def test_should_send_sms_template_to_and_persist_with_job_id(sample_job, sample_
key_type=KEY_TYPE_NORMAL
)
provider_tasks.deliver_sms.apply_async.assert_called_once_with(
(notification_id),
[notification_id],
queue="send-sms"
)
persisted_notification = Notification.query.filter_by(id=notification_id).one()
@@ -661,7 +661,7 @@ def test_should_use_email_template_and_persist(sample_email_template_with_placeh
persisted_notification = Notification.query.filter_by(id=notification_id).one()
provider_tasks.deliver_email.apply_async.assert_called_once_with(
(notification_id), queue='send-email')
[notification_id], queue='send-email')
assert persisted_notification.id == notification_id
assert persisted_notification.to == 'my_email@my_email.com'
@@ -698,7 +698,7 @@ def test_send_email_should_use_template_version_from_job_not_latest(sample_email
now.strftime(DATETIME_FORMAT)
)
provider_tasks.deliver_email.apply_async.assert_called_once_with((notification_id), queue='send-email')
provider_tasks.deliver_email.apply_async.assert_called_once_with([notification_id], queue='send-email')
persisted_notification = Notification.query.filter_by(id=notification_id).one()
assert persisted_notification.id == notification_id
@@ -726,7 +726,7 @@ def test_should_use_email_template_subject_placeholders(sample_email_template_wi
now.strftime(DATETIME_FORMAT)
)
provider_tasks.deliver_email.apply_async.assert_called_once_with(
(notification_id), queue='send-email'
[notification_id], queue='send-email'
)
persisted_notification = Notification.query.filter_by(id=notification_id).one()
assert persisted_notification.id == notification_id
@@ -752,7 +752,7 @@ def test_should_use_email_template_and_persist_without_personalisation(sample_em
encryption.encrypt(notification),
now.strftime(DATETIME_FORMAT)
)
provider_tasks.deliver_email.apply_async.assert_called_once_with((notification_id), queue='send-email')
provider_tasks.deliver_email.apply_async.assert_called_once_with([notification_id], queue='send-email')
persisted_notification = Notification.query.filter_by(id=notification_id).one()
assert persisted_notification.id == notification_id

View File

@@ -118,7 +118,7 @@ def test_send_notification_with_placeholders_replaced(notify_api, sample_email_t
data.update({"template_version": sample_email_template_with_placeholders.version})
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with(
(str(notification_id)),
[str(notification_id)],
queue="send-email"
)
assert response.status_code == 201
@@ -378,7 +378,7 @@ def test_should_allow_valid_sms_notification(notify_api, sample_template, mocker
notification_id = response_data['notification']['id']
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with(
(notification_id), queue='send-sms')
[notification_id], queue='send-sms')
assert response.status_code == 201
assert notification_id
assert 'subject' not in response_data
@@ -538,7 +538,7 @@ def test_should_allow_valid_email_notification(notify_api, sample_email_template
response_data = json.loads(response.get_data(as_text=True))['data']
notification_id = response_data['notification']['id']
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with(
(notification_id),
[notification_id],
queue="send-email"
)
@@ -742,7 +742,7 @@ def test_should_send_email_if_team_api_key_and_a_service_user(notify_api, sample
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with(
(fake_uuid),
[fake_uuid],
queue='send-email')
assert response.status_code == 201
@@ -776,7 +776,7 @@ def test_should_send_sms_to_anyone_with_test_key(
data=json.dumps(data),
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))]
)
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with((fake_uuid), queue='research-mode')
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with([fake_uuid], queue='research-mode')
assert response.status_code == 201
@@ -811,7 +811,7 @@ def test_should_send_email_to_anyone_with_test_key(
)
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with(
(fake_uuid), queue='research-mode')
[fake_uuid], queue='research-mode')
assert response.status_code == 201
@@ -837,7 +837,7 @@ def test_should_send_sms_if_team_api_key_and_a_service_user(notify_api, sample_t
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with(
(fake_uuid), queue='send-sms')
[fake_uuid], queue='send-sms')
assert response.status_code == 201
@@ -864,7 +864,7 @@ def test_should_persist_sms_notification(notify_api, sample_template, fake_uuid,
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with(
(fake_uuid), queue='send-sms')
[fake_uuid], queue='send-sms')
assert response.status_code == 201
notification = notifications_dao.get_notification_by_id(fake_uuid)
@@ -896,7 +896,7 @@ def test_should_persist_email_notification(notify_api, sample_email_template, fa
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with(
(fake_uuid), queue='send-email')
[fake_uuid], queue='send-email')
assert response.status_code == 201
notification = notifications_dao.get_notification_by_id(fake_uuid)
@@ -935,7 +935,7 @@ def test_should_delete_email_notification_and_return_error_if_sqs_fails(
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with(
(fake_uuid), queue='send-email')
[fake_uuid], queue='send-email')
assert response.status_code == 500
assert not notifications_dao.get_notification_by_id(fake_uuid)
@@ -967,7 +967,7 @@ def test_should_delete_sms_notification_and_return_error_if_sqs_fails(notify_api
data=json.dumps(data),
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with((fake_uuid), queue='send-sms')
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with([fake_uuid], queue='send-sms')
assert response.status_code == 500
assert not notifications_dao.get_notification_by_id(fake_uuid)