From 25a10a0292586a3e3de2543690c4431a7cfd1d24 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 12 Apr 2018 17:43:41 +0200 Subject: Fix and simplify permission management with profiles (refs #4046) --- ishtar_common/tests.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'ishtar_common/tests.py') diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 7bce12a4d..4ee47d723 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -416,12 +416,21 @@ class AccessControlTest(TestCase): user.save() ishtar_user = models.IshtarUser.objects.get( user_ptr__username='myusername') - self.assertIn(admin, ishtar_user.person.person_types.all()) + self.assertEqual( + models.UserProfile.objects.filter( + person__ishtaruser=ishtar_user, + profile_type__txt_idx='administrator' + ).count(), 1 + ) user = ishtar_user.user_ptr user.is_superuser = False user.save() - ishtar_user = models.IshtarUser.objects.get( - user_ptr__username='myusername') + self.assertEqual( + models.UserProfile.objects.filter( + person__ishtaruser=ishtar_user, + profile_type__txt_idx='administrator' + ).count(), 0 + ) self.assertNotIn(admin, ishtar_user.person.person_types.all()) @@ -1153,6 +1162,11 @@ class ImportTest(TestCase): class IshtarSiteProfileTest(TestCase): + fixtures = [settings.ROOT_PATH + + '../fixtures/initial_data-auth-fr.json', + settings.ROOT_PATH + + '../ishtar_common/fixtures/initial_data-fr.json',] + def testRelevance(self): cache.set('default-ishtarsiteprofile-is-current-profile', None, settings.CACHE_TIMEOUT) -- cgit v1.2.3