mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Update now to utcnow. All tests passing.
This commit is contained in:
@@ -121,7 +121,7 @@ def test_authentication_passes_when_service_has_multiple_keys_some_expired(
|
||||
with notify_api.test_client() as client:
|
||||
expired_key_data = {'service': sample_api_key.service,
|
||||
'name': 'expired_key',
|
||||
'expiry_date': datetime.now(),
|
||||
'expiry_date': datetime.utcnow(),
|
||||
'created_by': sample_api_key.created_by
|
||||
}
|
||||
expired_key = ApiKey(**expired_key_data)
|
||||
@@ -166,7 +166,7 @@ def test_authentication_returns_token_expired_when_service_uses_expired_key_and_
|
||||
expire_the_key = {'id': expired_api_key.id,
|
||||
'service': sample_api_key.service,
|
||||
'name': 'expired_key',
|
||||
'expiry_date': datetime.now() + timedelta(hours=-2),
|
||||
'expiry_date': datetime.utcnow() + timedelta(hours=-2),
|
||||
'created_by': sample_api_key.created_by}
|
||||
save_model_api_key(expired_api_key, expire_the_key)
|
||||
response = client.get(
|
||||
|
||||
@@ -781,7 +781,7 @@ def test_email_invited_user_should_send_email(notify_api, mocker):
|
||||
'service_id': '123123',
|
||||
'service_name': 'Blacksmith Service',
|
||||
'token': 'the-token',
|
||||
'expiry_date': str(datetime.now() + timedelta(days=1))
|
||||
'expiry_date': str(datetime.utcnow() + timedelta(days=1))
|
||||
}
|
||||
|
||||
mocker.patch('app.aws_ses_client.send_email')
|
||||
|
||||
@@ -5,7 +5,7 @@ from app.models import ProviderRates
|
||||
|
||||
|
||||
def test_create_provider_rates(notify_db, notify_db_session, mmg_provider_name):
|
||||
now = datetime.now()
|
||||
now = datetime.utcnow()
|
||||
rate = Decimal("1.00000")
|
||||
create_provider_rates(mmg_provider_name, now, rate)
|
||||
assert ProviderRates.query.count() == 1
|
||||
|
||||
@@ -41,9 +41,10 @@ def test_create_invited_user(notify_api, sample_service, mocker):
|
||||
assert json_resp['data']['permissions'] == 'send_messages,manage_service,manage_api_keys'
|
||||
assert json_resp['data']['id']
|
||||
invitation_expiration_days = notify_api.config['INVITATION_EXPIRATION_DAYS']
|
||||
expiry_date = (datetime.now() + timedelta(days=invitation_expiration_days)).replace(hour=0, minute=0,
|
||||
second=0,
|
||||
microsecond=0)
|
||||
expiry_date = (datetime.utcnow() + timedelta(days=invitation_expiration_days)).replace(hour=0,
|
||||
minute=0,
|
||||
second=0,
|
||||
microsecond=0)
|
||||
encrypted_invitation = {'to': email_address,
|
||||
'user_name': invite_from.name,
|
||||
'service_id': str(sample_service.id),
|
||||
|
||||
@@ -19,7 +19,7 @@ def test_get_delivery_status_all_ok(notify_api, notify_db):
|
||||
|
||||
def test_get_delivery_status_with_undelivered_notification(notify_api, notify_db, sample_notification):
|
||||
|
||||
more_than_five_mins_ago = datetime.now() - timedelta(minutes=10)
|
||||
more_than_five_mins_ago = datetime.utcnow() - timedelta(minutes=10)
|
||||
sample_notification.created_at = more_than_five_mins_ago
|
||||
notify_db.session.add(sample_notification)
|
||||
notify_db.session.commit()
|
||||
|
||||
@@ -110,7 +110,7 @@ def test_user_verify_code_email_expired_code(notify_api,
|
||||
with notify_api.test_client() as client:
|
||||
assert not VerifyCode.query.first().code_used
|
||||
sample_email_code.expiry_datetime = (
|
||||
datetime.now() - timedelta(hours=1))
|
||||
datetime.utcnow() - timedelta(hours=1))
|
||||
db.session.add(sample_email_code)
|
||||
db.session.commit()
|
||||
data = json.dumps({
|
||||
|
||||
Reference in New Issue
Block a user