diff --git a/pupa/tests/clean/test_clean.py b/pupa/tests/clean/test_clean.py index 0ca9e32..89de5de 100644 --- a/pupa/tests/clean/test_clean.py +++ b/pupa/tests/clean/test_clean.py @@ -65,24 +65,6 @@ def test_get_stale_objects(subparsers, organization, person): assert set(Command(subparsers).get_stale_objects(7)) == expected_stale_objects -@pytest.mark.django_db -def test_remove_stale_objects(subparsers, organization, person): - stale_person = person.build() - membership = stale_person.memberships.create(organization=organization) - - expected_stale_objects = {stale_person, organization, membership} - - a_week_from_now = datetime.now(tz=timezone.utc) + timedelta(days=7) - with freeze_time(a_week_from_now): - fresh_person = person.build(name="Thomas Jefferson", family_name="Jefferson") - fresh_person.memberships.create(organization=organization) - - Command(subparsers).remove_stale_objects(7) - for obj in expected_stale_objects: - was_deleted = not type(obj).objects.filter(id=obj.id).exists() - assert was_deleted - - @pytest.mark.django_db def test_clean_command(subparsers, organization, person): stale_person = person.build() @@ -106,8 +88,8 @@ def test_clean_command(subparsers, organization, person): was_deleted = not type(obj).objects.filter(id=obj.id).exists() assert was_deleted - expected_not_stale_objects = {organization, fresh_person, not_stale_membership} - for obj in expected_not_stale_objects: + expected_fresh_objects = {organization, fresh_person, not_stale_membership} + for obj in expected_fresh_objects: was_not_deleted = type(obj).objects.filter(id=obj.id).exists() assert was_not_deleted