mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 06:52:06 -05:00
Removed unused tests
This commit is contained in:
@@ -246,100 +246,6 @@ def test_user_verify_password_missing_password(notify_api,
|
||||
assert 'Required field missing data' in json_resp['message']['password']
|
||||
|
||||
|
||||
# TODO: Remove this test once the admin app has stopped using it.
|
||||
def test_send_user_code_for_sms(notify_api,
|
||||
sample_sms_code,
|
||||
mock_encryption,
|
||||
mock_celery_send_sms_code):
|
||||
"""
|
||||
Tests POST endpoint '/<user_id>/code' successful sms
|
||||
"""
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
data = json.dumps({'code_type': 'sms'})
|
||||
auth_header = create_authorization_header(
|
||||
path=url_for('user.send_user_code', user_id=sample_sms_code.user.id),
|
||||
method='POST',
|
||||
request_body=data)
|
||||
resp = client.post(
|
||||
url_for('user.send_user_code', user_id=sample_sms_code.user.id),
|
||||
data=data,
|
||||
headers=[('Content-Type', 'application/json'), auth_header])
|
||||
|
||||
assert resp.status_code == 204
|
||||
app.celery.tasks.send_sms_code.apply_async.assert_called_once_with(['something_encrypted'],
|
||||
queue='sms-code')
|
||||
|
||||
|
||||
# TODO: Remove this test once the admin app has stopped using it.
|
||||
def test_send_user_code_for_email(notify_api,
|
||||
sample_email_code,
|
||||
mock_secret_code,
|
||||
mock_celery_send_email_code,
|
||||
mock_encryption):
|
||||
"""
|
||||
Tests POST endpoint '/<user_id>/code' successful email
|
||||
"""
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
data = json.dumps({'code_type': 'email'})
|
||||
auth_header = create_authorization_header(
|
||||
path=url_for('user.send_user_code', user_id=sample_email_code.user.id),
|
||||
method='POST',
|
||||
request_body=data)
|
||||
resp = client.post(
|
||||
url_for('user.send_user_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')
|
||||
|
||||
|
||||
# TODO: Remove this test once the admin app has stopped using it.
|
||||
def test_send_user_code_for_email_uses_optional_to_field(notify_api,
|
||||
sample_email_code,
|
||||
mock_secret_code,
|
||||
mock_celery_send_email_code,
|
||||
mock_encryption):
|
||||
"""
|
||||
Tests POST endpoint '/<user_id>/code' successful email with included in body
|
||||
"""
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
data = json.dumps({'code_type': 'email', 'to': 'different@email.gov.uk'})
|
||||
auth_header = create_authorization_header(
|
||||
path=url_for('user.send_user_code', user_id=sample_email_code.user.id),
|
||||
method='POST',
|
||||
request_body=data)
|
||||
resp = client.post(
|
||||
url_for('user.send_user_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')
|
||||
|
||||
|
||||
# TODO: Remove this test once the admin app has stopped using it.
|
||||
def test_request_verify_code_schema_invalid_code_type(notify_api, sample_user):
|
||||
from app.schemas import old_request_verify_code_schema
|
||||
data = json.dumps({'code_type': 'not_sms'})
|
||||
code, error = old_request_verify_code_schema.loads(data)
|
||||
assert error == {'code_type': ['Invalid code type']}
|
||||
|
||||
|
||||
# TODO: Remove this method once the admin app has stopped using it.
|
||||
def test_request_verify_code_schema_with_to(notify_api, sample_user):
|
||||
from app.schemas import old_request_verify_code_schema
|
||||
data = json.dumps({'code_type': 'sms', 'to': 'some@one.gov.uk'})
|
||||
code, error = old_request_verify_code_schema.loads(data)
|
||||
assert code == {'code_type': 'sms', 'to': 'some@one.gov.uk'}
|
||||
assert error == {}
|
||||
|
||||
|
||||
def test_send_user_sms_code(notify_api,
|
||||
sample_sms_code,
|
||||
mock_celery_send_sms_code,
|
||||
|
||||
Reference in New Issue
Block a user