From eaaa9c6fa2252c0c2f6e6f43274398fdd21ed2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Riku=20Kestila=CC=88?= Date: Tue, 9 Jan 2024 14:47:16 +0200 Subject: [PATCH] fix: failing tests --- backend/benefit/applications/management/commands/seed.py | 7 ++++--- .../benefit/applications/tests/test_application_tasks.py | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/backend/benefit/applications/management/commands/seed.py b/backend/benefit/applications/management/commands/seed.py index 6542e0f2a0..f531aa24b6 100755 --- a/backend/benefit/applications/management/commands/seed.py +++ b/backend/benefit/applications/management/commands/seed.py @@ -39,9 +39,11 @@ def add_arguments(self, parser): def handle(self, *args, **options): batch_count = 6 - total_created = ((len(ApplicationStatus.values) * 2) + batch_count) * options[ - "number" + statuses = ApplicationStatus.values + filtered_statuses = [ + status for status in statuses if status != "rejected_by_talpa" ] + total_created = ((len(filtered_statuses) * 2) + batch_count) * options["number"] if not settings.DEBUG: self.stdout.write( "Seeding is allowed only when the DEBUG variable set to True" @@ -128,7 +130,6 @@ def _create_batch( _create_batch(ApplicationBatchStatus.DECIDED_ACCEPTED, ApplicationStatus.ACCEPTED) _create_batch(ApplicationBatchStatus.DECIDED_REJECTED, ApplicationStatus.REJECTED) - cancelled_deletion_threshold = _past_datetime(30) draft_deletion_threshold = _past_datetime(180) draft_notify_threshold = _past_datetime(180 - 14) diff --git a/backend/benefit/applications/tests/test_application_tasks.py b/backend/benefit/applications/tests/test_application_tasks.py index 7b34688a6f..04d504db65 100755 --- a/backend/benefit/applications/tests/test_application_tasks.py +++ b/backend/benefit/applications/tests/test_application_tasks.py @@ -15,13 +15,15 @@ def test_seed_applications_with_arguments(set_debug_to_true): amount = 5 statuses = ApplicationStatus.values + # exlude rejected_by_talpa status as it is not used in seeder + filtered_statuses = [status for status in statuses if status != "rejected_by_talpa"] batch_count = 6 - total_created = ((len(ApplicationStatus.values) * 2) + batch_count) * amount + total_created = ((len(filtered_statuses) * 2) + batch_count) * amount out = StringIO() call_command("seed", number=amount, stdout=out) seeded_applications = Application.objects.filter( - status__in=statuses, + status__in=filtered_statuses, ) assert seeded_applications.count() == total_created assert f"Created {total_created} applications" in out.getvalue()