mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-13 08:42:21 -05:00
Increase the number of days we rebuild the tables for
This commit is contained in:
@@ -24,7 +24,7 @@ def create_nightly_billing(day_start=None):
|
||||
else:
|
||||
# When calling the task its a string in the format of "YYYY-MM-DD"
|
||||
day_start = datetime.strptime(day_start, "%Y-%m-%d").date()
|
||||
for i in range(0, 4):
|
||||
for i in range(0, 10):
|
||||
process_day = day_start - timedelta(days=i)
|
||||
|
||||
transit_data = fetch_billing_data_for_day(process_day=process_day)
|
||||
@@ -47,7 +47,7 @@ def create_nightly_notification_status(day_start=None):
|
||||
else:
|
||||
# When calling the task its a string in the format of "YYYY-MM-DD"
|
||||
day_start = datetime.strptime(day_start, "%Y-%m-%d").date()
|
||||
for i in range(0, 4):
|
||||
for i in range(0, 10):
|
||||
process_day = day_start - timedelta(days=i)
|
||||
|
||||
transit_data = fetch_notification_status_for_day(process_day=process_day)
|
||||
|
||||
@@ -440,8 +440,8 @@ def test_create_nightly_notification_status(notify_db_session):
|
||||
create_notification(template=first_template, status='delivered')
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=1))
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=2))
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=4))
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=5))
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=10))
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=10))
|
||||
|
||||
create_notification(template=second_template, status='temporary-failure')
|
||||
create_notification(template=second_template, status='temporary-failure',
|
||||
@@ -449,15 +449,15 @@ def test_create_nightly_notification_status(notify_db_session):
|
||||
create_notification(template=second_template, status='temporary-failure',
|
||||
created_at=datetime.utcnow() - timedelta(days=2))
|
||||
create_notification(template=second_template, status='temporary-failure',
|
||||
created_at=datetime.utcnow() - timedelta(days=4))
|
||||
created_at=datetime.utcnow() - timedelta(days=10))
|
||||
create_notification(template=second_template, status='temporary-failure',
|
||||
created_at=datetime.utcnow() - timedelta(days=5))
|
||||
created_at=datetime.utcnow() - timedelta(days=10))
|
||||
|
||||
create_notification(template=third_template, status='created')
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=1))
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=2))
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=4))
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=5))
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=10))
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=10))
|
||||
|
||||
assert len(FactNotificationStatus.query.all()) == 0
|
||||
|
||||
@@ -467,7 +467,7 @@ def test_create_nightly_notification_status(notify_db_session):
|
||||
FactNotificationStatus.notification_type
|
||||
).all()
|
||||
assert len(new_data) == 9
|
||||
assert str(new_data[0].bst_date) == datetime.strftime(datetime.utcnow() - timedelta(days=4), "%Y-%m-%d")
|
||||
assert str(new_data[0].bst_date) == datetime.strftime(datetime.utcnow() - timedelta(days=10), "%Y-%m-%d")
|
||||
assert str(new_data[3].bst_date) == datetime.strftime(datetime.utcnow() - timedelta(days=2), "%Y-%m-%d")
|
||||
assert str(new_data[6].bst_date) == datetime.strftime(datetime.utcnow() - timedelta(days=1), "%Y-%m-%d")
|
||||
|
||||
@@ -482,10 +482,10 @@ def test_create_nightly_notification_status_respects_bst(sample_template):
|
||||
|
||||
create_notification(sample_template, status='temporary-failure', created_at=datetime(2019, 3, 31, 22, 59))
|
||||
|
||||
# we create records for last four days
|
||||
# we create records for last ten days
|
||||
create_notification(sample_template, status='sending', created_at=datetime(2019, 3, 29, 0, 0))
|
||||
|
||||
create_notification(sample_template, status='delivered', created_at=datetime(2019, 3, 28, 23, 59)) # too old
|
||||
create_notification(sample_template, status='delivered', created_at=datetime(2019, 3, 22, 23, 59)) # too old
|
||||
|
||||
create_nightly_notification_status()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user