Skip to content

Commit

Permalink
tests: add unix tombstone lifecycle tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjuhrich committed Jul 8, 2024
1 parent 0133eb5 commit f7b3726
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/model/test_unix_tombstone.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,22 @@ def test_user_deletion(self, session, user):


class TestTombstoneLifeCycle:
# TODO: FIXTURE: isolated unix tombstone, nothing else existing
@pytest.fixture(scope="class")
def tombstone(self, class_session):
tombstone = UnixTombstone(uid=999, login_hash=L_HASH)
class_session.add(tombstone)
return tombstone

def test_cannot_set_uid_null(self, session):
pytest.fail("TODO")
def test_cannot_set_uid_null(self, session, tombstone):
with pytest.raises(IntegrityError), session.begin_nested():
session.execute(
update(UnixTombstone).values(uid=None).where(UnixTombstone.uid == tombstone.uid)
)

def test_cannot_set_login_hash_null(self, session):
pytest.fail("TODO")
def test_cannot_set_login_hash_null(self, session, tombstone):
with pytest.raises(IntegrityError), session.begin_nested():
session.execute(
update(UnixTombstone)
.values(login_hash=None)
.where(UnixTombstone.uid == tombstone.uid)
)

0 comments on commit f7b3726

Please sign in to comment.