From 07bbd6c1dc34e387526a8c18743a302baf3ea7a8 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Fri, 25 Oct 2024 16:58:45 -0700 Subject: [PATCH] Fix and annotate delete_user tests --- tests/test_service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_service.py b/tests/test_service.py index 0b77369..f53b867 100644 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -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()