Skip to content

Commit

Permalink
Update tests for Django 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyface committed Mar 25, 2024
1 parent 6a2d119 commit 05b4b18
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions termsandconditions/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ def test_get_active_terms_list(self):
"""Test get list of active T&Cs"""
active_list = TermsAndConditions.get_active_terms_list()
self.assertEqual(2, len(active_list))
self.assertQuerysetEqual(active_list, [repr(self.terms3), repr(self.terms2)])
self.assertQuerySetEqual(active_list, [self.terms3, self.terms2])

def test_get_active_terms_not_agreed_to(self):
"""Test get T&Cs not agreed to"""
active_list = TermsAndConditions.get_active_terms_not_agreed_to(self.user1)
self.assertEqual(2, len(active_list))
self.assertQuerysetEqual(active_list, [repr(self.terms3), repr(self.terms2)])
self.assertQuerySetEqual(active_list, [self.terms3, self.terms2])

def test_user_is_excluded(self):
"""Test user3 has perm which excludes them from having to accept T&Cs"""
Expand All @@ -115,14 +115,14 @@ def test_superuser_is_not_implicitly_excluded(self):
"""Test su should have to accept T&Cs even if they are superuser but don't explicitly have the skip perm"""
active_list = TermsAndConditions.get_active_terms_not_agreed_to(self.su)
self.assertEqual(2, len(active_list))
self.assertQuerysetEqual(active_list, [repr(self.terms3), repr(self.terms2)])
self.assertQuerySetEqual(active_list, [self.terms3, self.terms2])

def test_superuser_cannot_skip(self):
"""Test su still has to accept even if they are explicitly given the skip perm"""
self.su.user_permissions.add(self.skip_perm)
active_list = TermsAndConditions.get_active_terms_not_agreed_to(self.su)
self.assertEqual(2, len(active_list))
self.assertQuerysetEqual(active_list, [repr(self.terms3), repr(self.terms2)])
self.assertQuerySetEqual(active_list, [self.terms3, self.terms2])

def test_superuser_excluded(self):
"""Test su doesn't have to accept with TERMS_EXCLUDE_SUPERUSERS set"""
Expand Down

0 comments on commit 05b4b18

Please sign in to comment.