mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-12 01:14:11 -04:00
Change email_access_validated_at formatting to be more in line with other dates on User model
This commit is contained in:
@@ -680,5 +680,5 @@ def format_thousands(value):
|
||||
|
||||
def is_less_than_90_days_ago(date_from_db):
|
||||
return (datetime.utcnow() - datetime.strptime(
|
||||
date_from_db, '%a, %d %b %Y %X %Z'
|
||||
date_from_db, "%Y-%m-%dT%H:%M:%S.%fZ"
|
||||
)).days < 90
|
||||
|
||||
@@ -49,7 +49,7 @@ def test_should_login_user_and_should_redirect_to_next_url(
|
||||
session['user_details'] = {
|
||||
'id': api_user_active['id'],
|
||||
'email': api_user_active['email_address']}
|
||||
api_user_active['email_access_validated_at'] = 'Sun, 23 Jan 2020 11:28:25 GMT'
|
||||
api_user_active['email_access_validated_at'] = '2020-01-23T11:35:21.726132Z'
|
||||
|
||||
response = client.post(url_for('main.two_factor', next='/services/{}'.format(SERVICE_ONE_ID)),
|
||||
data={'sms_code': '12345'})
|
||||
@@ -72,7 +72,7 @@ def test_should_send_email_and_redirect_to_info_page_if_user_needs_to_revalidate
|
||||
mocker
|
||||
):
|
||||
mocker.patch('app.user_api_client.get_user', return_value=api_user_active)
|
||||
api_user_active['email_access_validated_at'] = 'Sun, 03 Mar 2019 11:28:25 GMT'
|
||||
api_user_active['email_access_validated_at'] = '2019-03-23T11:35:21.726132Z'
|
||||
with client.session_transaction() as session:
|
||||
session['user_details'] = {
|
||||
'id': api_user_active['id'],
|
||||
@@ -99,7 +99,7 @@ def test_should_login_user_and_not_redirect_to_external_url(
|
||||
session['user_details'] = {
|
||||
'id': api_user_active['id'],
|
||||
'email': api_user_active['email_address']}
|
||||
api_user_active['email_access_validated_at'] = 'Sun, 23 Jan 2020 11:28:25 GMT'
|
||||
api_user_active['email_access_validated_at'] = '2020-01-23T11:35:21.726132Z'
|
||||
|
||||
response = client.post(url_for('main.two_factor', next='http://www.google.com'),
|
||||
data={'sms_code': '12345'})
|
||||
@@ -120,7 +120,7 @@ def test_should_login_user_and_redirect_to_show_accounts(
|
||||
session['user_details'] = {
|
||||
'id': api_user_active['id'],
|
||||
'email': api_user_active['email_address']}
|
||||
api_user_active['email_access_validated_at'] = 'Sun, 23 Jan 2020 11:28:25 GMT'
|
||||
api_user_active['email_access_validated_at'] = '2020-01-23T11:35:21.726132Z'
|
||||
|
||||
response = client.post(url_for('main.two_factor'),
|
||||
data={'sms_code': '12345'})
|
||||
@@ -162,7 +162,7 @@ def test_should_login_user_when_multiple_valid_codes_exist(
|
||||
session['user_details'] = {
|
||||
'id': api_user_active['id'],
|
||||
'email': api_user_active['email_address']}
|
||||
api_user_active['email_access_validated_at'] = 'Sun, 23 Jan 2020 11:28:25 GMT'
|
||||
api_user_active['email_access_validated_at'] = '2020-01-23T11:35:21.726132Z'
|
||||
|
||||
response = client.post(url_for('main.two_factor'),
|
||||
data={'sms_code': '23456'})
|
||||
@@ -184,7 +184,7 @@ def test_two_factor_should_set_password_when_new_password_exists_in_session(
|
||||
'id': api_user_active['id'],
|
||||
'email': api_user_active['email_address'],
|
||||
'password': 'changedpassword'}
|
||||
api_user_active['email_access_validated_at'] = 'Sun, 23 Jan 2020 11:28:25 GMT'
|
||||
api_user_active['email_access_validated_at'] = '2020-01-23T11:35:21.726132Z'
|
||||
|
||||
response = client.post(url_for('main.two_factor'),
|
||||
data={'sms_code': '12345'})
|
||||
@@ -234,7 +234,7 @@ def test_two_factor_should_activate_pending_user(
|
||||
):
|
||||
mocker.patch('app.user_api_client.get_user', return_value=api_user_pending)
|
||||
mocker.patch('app.service_api_client.get_services', return_value={'data': []})
|
||||
api_user_pending['email_access_validated_at'] = 'Sun, 23 Jan 2020 11:28:25 GMT'
|
||||
api_user_pending['email_access_validated_at'] = '2020-01-23T11:35:21.726132Z'
|
||||
with client.session_transaction() as session:
|
||||
session['user_details'] = {
|
||||
'id': api_user_pending['id'],
|
||||
|
||||
@@ -510,8 +510,8 @@ def test_get_letter_validation_error_for_known_errors(
|
||||
|
||||
|
||||
@pytest.mark.parametrize("date_from_db, expected_result", [
|
||||
('Sun, 17 Nov 2019 11:28:25 GMT', True),
|
||||
('Sun, 16 Nov 2019 11:28:25 GMT', False),
|
||||
('2019-11-17T11:35:21.726132Z', True),
|
||||
('2019-11-16T11:35:21.726132Z', False),
|
||||
])
|
||||
@freeze_time('2020-02-14T12:00:00')
|
||||
def test_is_less_than_90_days_ago(date_from_db, expected_result):
|
||||
|
||||
Reference in New Issue
Block a user