Skip to content

Commit

Permalink
Fix and annotate delete_user tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Oct 25, 2024
1 parent 19a1fcf commit 07bbd6c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,20 @@ def test_delete_user(self):
invalid_user = User(username="user", password_hash="test")
incomplete_user = service.read_unauthenticated_user(user_1.user_id)

# Requested user not in the database
with self.assertRaises(UserNotFoundError):
service.delete_user(invalid_user)

# Request missing sensitive user information
with self.assertRaises(UserNotMatchedError):
service.delete_user(incomplete_user)

# Successful deletion
deleted = service.delete_user(user_1)
self.assertEqual(deleted, user_1)

with self.assertRaises(UserNotMatchedError):
# User already removed
with self.assertRaises(UserNotFoundError):
service.read_unauthenticated_user(user_1.user_id)

service.shutdown()

0 comments on commit 07bbd6c

Please sign in to comment.