Skip to content

Commit

Permalink
test: add user not deleted test; fix deletion test
Browse files Browse the repository at this point in the history
  • Loading branch information
paulschreiber committed Feb 23, 2024
1 parent 181c6ba commit 48caa18
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion terraso_backend/tests/core/commands/test_harddelete.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
pytestmark = pytest.mark.django_db


@pytest.mark.parametrize("model", [User, Group, DataEntry])
@pytest.mark.parametrize("model", [Group, DataEntry])
def test_delete_model_deleted(model, delete_date):
obj = mixer.blend(model)
obj.delete()
Expand All @@ -35,6 +35,18 @@ def test_delete_model_deleted(model, delete_date):
), "Model should be deleted"


@pytest.mark.parametrize("model", [User])
def test_delete_user_not_deleted(model, delete_date):
obj = mixer.blend(model)
obj.delete()
obj.deleted_at = delete_date
obj.save(keep_deleted=True)
call_command("harddelete")
assert (
model.objects.all(force_visibility=True).filter(id=obj.id).exists()
), "Model should not be deleted"


@pytest.mark.parametrize("model", [User, Group, DataEntry])
def test_delete_model_not_deleted(model, no_delete_date):
obj = mixer.blend(model)
Expand Down

0 comments on commit 48caa18

Please sign in to comment.