mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Use dashes in the celery queue names
This commit is contained in:
@@ -139,7 +139,7 @@ def send_user_code(user_id):
|
|||||||
if verify_code.get('code_type') == 'sms':
|
if verify_code.get('code_type') == 'sms':
|
||||||
mobile = user.mobile_number if verify_code.get('to', None) is None else verify_code.get('to')
|
mobile = user.mobile_number if verify_code.get('to', None) is None else verify_code.get('to')
|
||||||
verification_message = {'to': mobile, 'secret_code': secret_code}
|
verification_message = {'to': mobile, 'secret_code': secret_code}
|
||||||
send_sms_code.apply_async([encryption.encrypt(verification_message)], queue='sms_code')
|
send_sms_code.apply_async([encryption.encrypt(verification_message)], queue='sms-code')
|
||||||
elif verify_code.get('code_type') == 'email':
|
elif verify_code.get('code_type') == 'email':
|
||||||
email = user.email_address if verify_code.get('to', None) is None else verify_code.get('to')
|
email = user.email_address if verify_code.get('to', None) is None else verify_code.get('to')
|
||||||
verification_message = {
|
verification_message = {
|
||||||
@@ -147,7 +147,7 @@ def send_user_code(user_id):
|
|||||||
'from_address': current_app.config['VERIFY_CODE_FROM_EMAIL_ADDRESS'],
|
'from_address': current_app.config['VERIFY_CODE_FROM_EMAIL_ADDRESS'],
|
||||||
'subject': 'Verification code',
|
'subject': 'Verification code',
|
||||||
'body': secret_code}
|
'body': secret_code}
|
||||||
send_email_code.apply_async([encryption.encrypt(verification_message)], queue='email_code')
|
send_email_code.apply_async([encryption.encrypt(verification_message)], queue='email-code')
|
||||||
else:
|
else:
|
||||||
abort(500)
|
abort(500)
|
||||||
return jsonify({}), 204
|
return jsonify({}), 204
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ def test_send_user_code_for_sms(notify_api,
|
|||||||
|
|
||||||
assert resp.status_code == 204
|
assert resp.status_code == 204
|
||||||
encrpyted = encryption.encrypt({'to': sample_sms_code.user.mobile_number, 'secret_code': '11111'})
|
encrpyted = encryption.encrypt({'to': sample_sms_code.user.mobile_number, 'secret_code': '11111'})
|
||||||
app.celery.tasks.send_sms_code.apply_async.assert_called_once_with([encrpyted], queue='sms_code')
|
app.celery.tasks.send_sms_code.apply_async.assert_called_once_with([encrpyted], queue='sms-code')
|
||||||
|
|
||||||
|
|
||||||
def test_send_user_code_for_sms_with_optional_to_field(notify_api,
|
def test_send_user_code_for_sms_with_optional_to_field(notify_api,
|
||||||
@@ -295,7 +295,7 @@ def test_send_user_code_for_sms_with_optional_to_field(notify_api,
|
|||||||
|
|
||||||
assert resp.status_code == 204
|
assert resp.status_code == 204
|
||||||
encrypted = encryption.encrypt({'to': '+441119876757', 'secret_code': '11111'})
|
encrypted = encryption.encrypt({'to': '+441119876757', 'secret_code': '11111'})
|
||||||
app.celery.tasks.send_sms_code.apply_async.assert_called_once_with([encrypted], queue='sms_code')
|
app.celery.tasks.send_sms_code.apply_async.assert_called_once_with([encrypted], queue='sms-code')
|
||||||
|
|
||||||
|
|
||||||
def test_send_user_code_for_email(notify_api,
|
def test_send_user_code_for_email(notify_api,
|
||||||
@@ -320,7 +320,7 @@ def test_send_user_code_for_email(notify_api,
|
|||||||
assert resp.status_code == 204
|
assert resp.status_code == 204
|
||||||
|
|
||||||
app.celery.tasks.send_email_code.apply_async.assert_called_once_with(['something_encrypted'],
|
app.celery.tasks.send_email_code.apply_async.assert_called_once_with(['something_encrypted'],
|
||||||
queue='email_code')
|
queue='email-code')
|
||||||
|
|
||||||
|
|
||||||
def test_send_user_code_for_email_uses_optional_to_field(notify_api,
|
def test_send_user_code_for_email_uses_optional_to_field(notify_api,
|
||||||
@@ -345,7 +345,7 @@ def test_send_user_code_for_email_uses_optional_to_field(notify_api,
|
|||||||
assert resp.status_code == 204
|
assert resp.status_code == 204
|
||||||
|
|
||||||
app.celery.tasks.send_email_code.apply_async.assert_called_once_with(['something_encrypted'],
|
app.celery.tasks.send_email_code.apply_async.assert_called_once_with(['something_encrypted'],
|
||||||
queue='email_code')
|
queue='email-code')
|
||||||
|
|
||||||
|
|
||||||
def test_request_verify_code_schema_invalid_code_type(notify_api, notify_db, notify_db_session, sample_user):
|
def test_request_verify_code_schema_invalid_code_type(notify_api, notify_db, notify_db_session, sample_user):
|
||||||
|
|||||||
Reference in New Issue
Block a user