Extracted serialiser for encryption into a flask module

- allows mocking easier
- shared across methods
- not built everytime
This commit is contained in:
Martyn Inglis
2016-02-16 15:28:30 +00:00
parent e42da7dd54
commit 18d63e241b
7 changed files with 46 additions and 16 deletions

View File

@@ -200,6 +200,7 @@ def test_should_allow_valid_sms_notification(notify_api, sample_template, mocker
with notify_api.test_request_context():
with notify_api.test_client() as client:
mocker.patch('app.celery.tasks.send_sms.apply_async')
mocker.patch('app.encryption.encrypt', return_value="something_encrypted")
data = {
'to': '+441234123123',
@@ -222,9 +223,7 @@ def test_should_allow_valid_sms_notification(notify_api, sample_template, mocker
app.celery.tasks.send_sms.apply_async.assert_called_once_with(
(str(sample_template.service_id),
notification_id,
ANY,
notify_api.config['SECRET_KEY'],
notify_api.config['DANGEROUS_SALT'])
"something_encrypted")
)
assert response.status_code == 201
assert notification_id