diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 9bf47c9d7..3ab7043a2 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -72,10 +72,7 @@ def process_job(job_id): 'job': str(job.id), 'to': recipient, 'row_number': row_number, - 'personalisation': { - key: personalisation.get(key) - for key in template.placeholders - } + 'personalisation': dict(personalisation) }) if template.template_type == SMS_TYPE: diff --git a/requirements.txt b/requirements.txt index 594f12317..d6166c2d5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,6 +21,6 @@ jsonschema==2.5.1 git+https://github.com/alphagov/notifications-python-client.git@2.0.0#egg=notifications-python-client==2.0.0 -git+https://github.com/alphagov/notifications-utils.git@9.1.1#egg=notifications-utils==9.1.1 +git+https://github.com/alphagov/notifications-utils.git@9.2.1#egg=notifications-utils==9.2.1 git+https://github.com/alphagov/boto.git@2.43.0-patch3#egg=boto==2.43.0-patch3 diff --git a/tests/app/conftest.py b/tests/app/conftest.py index 002c7c13c..2817e5dcc 100644 --- a/tests/app/conftest.py +++ b/tests/app/conftest.py @@ -190,7 +190,8 @@ def sample_template(notify_db, @pytest.fixture(scope='function') def sample_template_with_placeholders(notify_db, notify_db_session): - return sample_template(notify_db, notify_db_session, content="Hello ((name))\nYour thing is due soon") + # deliberate space and title case in placeholder + return sample_template(notify_db, notify_db_session, content="Hello (( Name))\nYour thing is due soon") @pytest.fixture(scope='function') diff --git a/tests/app/invite/test_invite_rest.py b/tests/app/invite/test_invite_rest.py index 301bf6e69..9cf9c2f13 100644 --- a/tests/app/invite/test_invite_rest.py +++ b/tests/app/invite/test_invite_rest.py @@ -85,7 +85,7 @@ def test_create_invited_user_invalid_email(notify_api, sample_service, mocker): assert response.status_code == 400 json_resp = json.loads(response.get_data(as_text=True)) assert json_resp['result'] == 'error' - assert json_resp['message'] == {'email_address': ['Not a valid email address']} + assert json_resp['message'] == {'email_address': ['Not a valid email address.']} app.celery.tasks.send_email.apply_async.assert_not_called() diff --git a/tests/app/notifications/rest/test_send_notification.py b/tests/app/notifications/rest/test_send_notification.py index 78c45b748..74b6fbdee 100644 --- a/tests/app/notifications/rest/test_send_notification.py +++ b/tests/app/notifications/rest/test_send_notification.py @@ -306,7 +306,7 @@ def test_should_reject_email_notification_with_bad_email(notify_api, sample_emai mocked.apply_async.assert_not_called() assert response.status_code == 400 assert data['result'] == 'error' - assert data['message']['to'][0] == 'Not a valid email address' + assert data['message']['to'][0] == 'Not a valid email address.' @freeze_time("2016-01-01 11:09:00.061258") @@ -914,7 +914,7 @@ def test_create_template_raises_invalid_request_exception_with_missing_personali from app.notifications.rest import create_template_object_for_notification with pytest.raises(InvalidRequest) as e: create_template_object_for_notification(template, {}) - assert {'template': ['Missing personalisation: name']} == e.value.message + assert {'template': ['Missing personalisation: Name']} == e.value.message def test_create_template_raises_invalid_request_exception_with_too_much_personalisation_data( diff --git a/tests/app/user/test_rest.py b/tests/app/user/test_rest.py index 14b26d387..2de1f7c38 100644 --- a/tests/app/user/test_rest.py +++ b/tests/app/user/test_rest.py @@ -470,7 +470,7 @@ def test_send_user_reset_password_should_return_400_when_data_is_not_email_addre headers=[('Content-Type', 'application/json'), auth_header]) assert resp.status_code == 400 - assert json.loads(resp.get_data(as_text=True))['message'] == {'email': ['Not a valid email address']} + assert json.loads(resp.get_data(as_text=True))['message'] == {'email': ['Not a valid email address.']} @freeze_time("2016-01-01 11:09:00.061258")