Skip to content

Commit

Permalink
Next fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed Jun 4, 2024
1 parent c4a52df commit 8eb41ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ django-slack==5.19.0
git+https://github.com/DefectDojo/django-tagging@develop#egg=django-tagging
django-watson==1.6.3
django-prometheus==2.3.1
# Django==4.2.11 # TODO
Django==4.2.10
djangorestframework==3.14.0
html2text==2024.2.26
Expand Down
8 changes: 4 additions & 4 deletions unittests/test_user_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ def tearDown(self):
def test_user_none(self, mock_current_user):
mock_current_user.return_value = None

self.assertQuerysetEqual(Dojo_User.objects.none(), get_authorized_users(Permissions.Product_View))
self.assertQuerySetEqual(Dojo_User.objects.none(), get_authorized_users(Permissions.Product_View))

@patch('dojo.user.queries.get_current_user')
def test_user_admin(self, mock_current_user):
mock_current_user.return_value = self.admin_user

users = Dojo_User.objects.all().order_by('first_name', 'last_name', 'username')
self.assertQuerysetEqual(users, get_authorized_users(Permissions.Product_View))
self.assertQuerySetEqual(users, get_authorized_users(Permissions.Product_View))

@patch('dojo.user.queries.get_current_user')
def test_user_global_permission(self, mock_current_user):
mock_current_user.return_value = self.global_permission_user

users = Dojo_User.objects.all().order_by('first_name', 'last_name', 'username')
self.assertQuerysetEqual(users, get_authorized_users(Permissions.Product_View))
self.assertQuerySetEqual(users, get_authorized_users(Permissions.Product_View))

@patch('dojo.user.queries.get_current_user')
@patch('dojo.product.queries.get_current_user')
Expand All @@ -82,4 +82,4 @@ def test_user_regular(self, mock_current_user_1, mock_current_user_2):
mock_current_user_2.return_value = self.regular_user

users = Dojo_User.objects.exclude(username='invisible_user').order_by('first_name', 'last_name', 'username')
self.assertQuerysetEqual(users, get_authorized_users(Permissions.Product_View))
self.assertQuerySetEqual(users, get_authorized_users(Permissions.Product_View))

0 comments on commit 8eb41ff

Please sign in to comment.