Working on getting expiration implemented.

Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
Cliff Hill
2023-11-07 15:28:27 -05:00
parent 570ee6cd86
commit 3e6a7931d8
7 changed files with 30 additions and 24 deletions

View File

@@ -11,7 +11,7 @@ from app.celery.scheduled_tasks import (
check_for_missing_rows_in_completed_jobs,
check_for_services_with_high_failure_rates_or_sending_to_tv_numbers,
check_job_status,
delete_invitations,
expire_or_delete_invitations,
delete_verify_codes,
replay_created_notifications,
run_scheduled_jobs,
@@ -44,11 +44,11 @@ def test_should_call_delete_invotations_on_delete_invitations_task(
notify_db_session, mocker
):
mocker.patch(
"app.celery.scheduled_tasks.delete_invitations_created_more_than_two_days_ago"
"app.celery.scheduled_tasks.expire_invitations_created_more_than_two_days_ago"
)
delete_invitations()
expire_or_delete_invitations()
assert (
scheduled_tasks.delete_invitations_created_more_than_two_days_ago.call_count
scheduled_tasks.expire_invitations_created_more_than_two_days_ago.call_count
== 1
)

View File

@@ -6,7 +6,7 @@ from sqlalchemy.orm.exc import NoResultFound
from app import db
from app.dao.invited_user_dao import (
delete_invitations_created_more_than_two_days_ago,
expire_invitations_created_more_than_two_days_ago,
get_invited_user_by_id,
get_invited_user_by_service_and_id,
get_invited_users_for_service,
@@ -122,7 +122,7 @@ def test_should_delete_all_invitations_more_than_one_day_old(
make_invitation(sample_user, sample_service, age=timedelta(hours=48))
make_invitation(sample_user, sample_service, age=timedelta(hours=48))
assert len(InvitedUser.query.all()) == 2
delete_invitations_created_more_than_two_days_ago()
expire_invitations_created_more_than_two_days_ago()
assert len(InvitedUser.query.all()) == 0
@@ -143,7 +143,7 @@ def test_should_not_delete_invitations_less_than_two_days_old(
)
assert len(InvitedUser.query.all()) == 2
delete_invitations_created_more_than_two_days_ago()
expire_invitations_created_more_than_two_days_ago()
assert len(InvitedUser.query.all()) == 1
assert InvitedUser.query.first().email_address == "valid@2.com"