diff --git a/terraso_backend/tests/core/commands/test_harddelete.py b/terraso_backend/tests/core/commands/test_harddelete.py index d647cc319..38f740f4a 100644 --- a/terraso_backend/tests/core/commands/test_harddelete.py +++ b/terraso_backend/tests/core/commands/test_harddelete.py @@ -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() @@ -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)