mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
more time test times
This commit is contained in:
@@ -302,7 +302,7 @@ def save_daily_notification_processing_time(est_date=None):
|
|||||||
result = dao_get_notifications_processing_time_stats(start_time, end_time)
|
result = dao_get_notifications_processing_time_stats(start_time, end_time)
|
||||||
insert_update_processing_time(
|
insert_update_processing_time(
|
||||||
FactProcessingTime(
|
FactProcessingTime(
|
||||||
est_date=est_date,
|
bst_date=est_date,
|
||||||
messages_total=result.messages_total,
|
messages_total=result.messages_total,
|
||||||
messages_within_10_secs=result.messages_within_10_secs
|
messages_within_10_secs=result.messages_within_10_secs
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -419,8 +419,8 @@ def test_save_daily_notification_processing_time_when_in_est(mocker, sample_temp
|
|||||||
# notification counted and sent within 10 seconds
|
# notification counted and sent within 10 seconds
|
||||||
create_notification(
|
create_notification(
|
||||||
sample_template,
|
sample_template,
|
||||||
created_at=datetime(2021, 4, 16, 23, 00),
|
created_at=datetime(2021, 4, 17, 4, 00),
|
||||||
sent_at=datetime(2021, 4, 16, 23, 00) + timedelta(seconds=5)
|
sent_at=datetime(2021, 4, 17, 4, 00) + timedelta(seconds=5)
|
||||||
)
|
)
|
||||||
# notification counted and sent within 10 seconds
|
# notification counted and sent within 10 seconds
|
||||||
create_notification(
|
create_notification(
|
||||||
@@ -431,8 +431,8 @@ def test_save_daily_notification_processing_time_when_in_est(mocker, sample_temp
|
|||||||
# notification created too late to be counted
|
# notification created too late to be counted
|
||||||
create_notification(
|
create_notification(
|
||||||
sample_template,
|
sample_template,
|
||||||
created_at=datetime(2021, 4, 17, 23, 00),
|
created_at=datetime(2021, 4, 18, 23, 00),
|
||||||
sent_at=datetime(2021, 4, 17, 23, 00) + timedelta(seconds=15)
|
sent_at=datetime(2021, 4, 18, 23, 00) + timedelta(seconds=15)
|
||||||
)
|
)
|
||||||
|
|
||||||
save_daily_notification_processing_time(date_provided)
|
save_daily_notification_processing_time(date_provided)
|
||||||
@@ -444,7 +444,7 @@ def test_save_daily_notification_processing_time_when_in_est(mocker, sample_temp
|
|||||||
assert persisted_to_db[0].messages_within_10_secs == 2
|
assert persisted_to_db[0].messages_within_10_secs == 2
|
||||||
|
|
||||||
|
|
||||||
@freeze_time('2021-06-05 03:00')
|
@freeze_time('2021-06-05 08:00')
|
||||||
def test_delete_notifications_task_calls_task_for_services_with_data_retention_of_same_type(notify_db_session, mocker):
|
def test_delete_notifications_task_calls_task_for_services_with_data_retention_of_same_type(notify_db_session, mocker):
|
||||||
sms_service = create_service(service_name='a')
|
sms_service = create_service(service_name='a')
|
||||||
email_service = create_service(service_name='b')
|
email_service = create_service(service_name='b')
|
||||||
@@ -462,7 +462,7 @@ def test_delete_notifications_task_calls_task_for_services_with_data_retention_o
|
|||||||
'service_id': sms_service.id,
|
'service_id': sms_service.id,
|
||||||
'notification_type': 'sms',
|
'notification_type': 'sms',
|
||||||
# three days of retention, its morn of 5th, so we want to keep all messages from 4th, 3rd and 2nd.
|
# three days of retention, its morn of 5th, so we want to keep all messages from 4th, 3rd and 2nd.
|
||||||
'datetime_to_delete_before': datetime(2021, 6, 1, 23, 0),
|
'datetime_to_delete_before': datetime(2021, 6, 2, 4, 0),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -485,12 +485,12 @@ def test_delete_notifications_task_calls_task_for_services_with_data_retention_b
|
|||||||
call(queue=ANY, kwargs={
|
call(queue=ANY, kwargs={
|
||||||
'service_id': service_14_days.id,
|
'service_id': service_14_days.id,
|
||||||
'notification_type': 'sms',
|
'notification_type': 'sms',
|
||||||
'datetime_to_delete_before': datetime(2021, 3, 22, 0, 0)
|
'datetime_to_delete_before': datetime(2021, 3, 21, 4, 0)
|
||||||
}),
|
}),
|
||||||
call(queue=ANY, kwargs={
|
call(queue=ANY, kwargs={
|
||||||
'service_id': service_3_days.id,
|
'service_id': service_3_days.id,
|
||||||
'notification_type': 'sms',
|
'notification_type': 'sms',
|
||||||
'datetime_to_delete_before': datetime(2021, 4, 1, 23, 0)
|
'datetime_to_delete_before': datetime(2021, 4, 1, 4, 0)
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -528,11 +528,11 @@ def test_delete_notifications_task_calls_task_for_services_that_have_sent_notifi
|
|||||||
call(queue=ANY, kwargs={
|
call(queue=ANY, kwargs={
|
||||||
'service_id': service_will_delete_1.id,
|
'service_id': service_will_delete_1.id,
|
||||||
'notification_type': 'sms',
|
'notification_type': 'sms',
|
||||||
'datetime_to_delete_before': datetime(2021, 3, 27, 0, 0)
|
'datetime_to_delete_before': datetime(2021, 3, 26, 4, 0)
|
||||||
}),
|
}),
|
||||||
call(queue=ANY, kwargs={
|
call(queue=ANY, kwargs={
|
||||||
'service_id': service_will_delete_2.id,
|
'service_id': service_will_delete_2.id,
|
||||||
'notification_type': 'sms',
|
'notification_type': 'sms',
|
||||||
'datetime_to_delete_before': datetime(2021, 3, 27, 0, 0)
|
'datetime_to_delete_before': datetime(2021, 3, 26, 4, 0)
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user