mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Remove send email code task
We don’t send email codes any more
This commit is contained in:
@@ -6,7 +6,6 @@ from notifications_utils.recipients import validate_phone_number, format_phone_n
|
||||
from app.celery.tasks import (
|
||||
send_sms,
|
||||
send_sms_code,
|
||||
send_email_code,
|
||||
send_email,
|
||||
process_job,
|
||||
email_invited_user,
|
||||
@@ -763,23 +762,6 @@ def test_should_throw_mmg_client_exception(mocker):
|
||||
'send-sms-code')
|
||||
|
||||
|
||||
def test_should_send_email_code(mocker):
|
||||
verification = {'to': 'someone@it.gov.uk',
|
||||
'secret_code': 11111}
|
||||
|
||||
encrypted_verification = encryption.encrypt(verification)
|
||||
mocker.patch('app.aws_ses_client.send_email')
|
||||
|
||||
send_email_code(encrypted_verification)
|
||||
|
||||
aws_ses_client.send_email.assert_called_once_with(
|
||||
current_app.config['VERIFY_CODE_FROM_EMAIL_ADDRESS'],
|
||||
verification['to'],
|
||||
"Verification code",
|
||||
"{} is your Notify authentication code".format(verification['secret_code'])
|
||||
)
|
||||
|
||||
|
||||
def test_email_invited_user_should_send_email(notify_api, mocker):
|
||||
with notify_api.test_request_context():
|
||||
invitation = {'to': 'new_person@it.gov.uk',
|
||||
|
||||
@@ -344,11 +344,6 @@ def mock_celery_send_sms_code(mocker):
|
||||
return mocker.patch('app.celery.tasks.send_sms_code.apply_async')
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_celery_send_email_code(mocker):
|
||||
return mocker.patch('app.celery.tasks.send_email_code.apply_async')
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_celery_email_registration_verification(mocker):
|
||||
return mocker.patch('app.celery.tasks.email_registration_verification.apply_async')
|
||||
|
||||
@@ -313,51 +313,6 @@ def test_send_sms_code_returns_404_for_bad_input_data(notify_api, notify_db, not
|
||||
assert json.loads(resp.get_data(as_text=True))['message'] == 'No result found'
|
||||
|
||||
|
||||
def test_send_user_email_code(notify_api,
|
||||
sample_email_code,
|
||||
mock_celery_send_email_code,
|
||||
mock_encryption):
|
||||
"""
|
||||
Tests POST endpoint /user/<user_id>/email-code
|
||||
"""
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
data = json.dumps({})
|
||||
auth_header = create_authorization_header(
|
||||
path=url_for('user.send_user_email_code', user_id=sample_email_code.user.id),
|
||||
method='POST',
|
||||
request_body=data)
|
||||
resp = client.post(
|
||||
url_for('user.send_user_email_code', user_id=sample_email_code.user.id),
|
||||
data=data,
|
||||
headers=[('Content-Type', 'application/json'), auth_header])
|
||||
assert resp.status_code == 204
|
||||
app.celery.tasks.send_email_code.apply_async.assert_called_once_with(['something_encrypted'],
|
||||
queue='email-code')
|
||||
|
||||
|
||||
def test_send_user_email_code_returns_404_for_when_user_does_not_exist(notify_api,
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
fake_uuid):
|
||||
"""
|
||||
Tests POST endpoint /user/<user_id>/email-code return 404 for missing user
|
||||
"""
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
data = json.dumps({})
|
||||
auth_header = create_authorization_header(
|
||||
path=url_for('user.send_user_email_code', user_id=fake_uuid),
|
||||
method='POST',
|
||||
request_body=data)
|
||||
resp = client.post(
|
||||
url_for('user.send_user_email_code', user_id=fake_uuid),
|
||||
data=data,
|
||||
headers=[('Content-Type', 'application/json'), auth_header])
|
||||
assert resp.status_code == 404
|
||||
assert json.loads(resp.get_data(as_text=True))['message'] == 'No result found'
|
||||
|
||||
|
||||
def test_send_user_email_verification(notify_api,
|
||||
sample_email_code,
|
||||
mock_celery_email_registration_verification,
|
||||
|
||||
Reference in New Issue
Block a user