Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

added test case to make sure newly created temporary user did not have full permissions and was not marked trustworthy

emuthb238da9d0bb7
diff --git a/wger/core/tests/test_temporary_users.py b/wger/core/tests/test_temporary_users.py
index 253700475..5c40d30ac 100644
--- a/wger/core/tests/test_temporary_users.py
+++ b/wger/core/tests/test_temporary_users.py
@@ -196,3 +196,18 @@ class DemoUserTestCase(WgerTestCase):
self.assertEqual(self.count_temp_users(), 18)
call_command('delete-temp-users')
self.assertEqual(self.count_temp_users(), 2)
+
+ def test_temporary_user_no_permissions(self):
+ """
+ Tests that temporary users do not pass the "is trustworthy" check and do not have
+ any permissions.
+ """
+
+ # Get a temporary user
+ user = create_temporary_user()
+
+ # User does not pass trustworthiness check
+ self.assertFalse(user.userprofile.is_trustworthy)
+
+ # User does not pass admin/exercise editor permissions check
+ self.assertFalse(user.userprofile.has_exercise_permission)