From 69b5bb17321d0983f980e1b1d2a7c5992b658452 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 13 Apr 2017 17:33:41 +0200 Subject: Test: a superuser gain the "administrator" person type --- ishtar_common/tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ishtar_common/tests.py') diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 095056c2e..a91a0ba58 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -288,6 +288,17 @@ class CacheTest(TestCase): self.assertFalse('testy' in types) +class AccessControlTest(TestCase): + def test_administrator(self): + admin, created = models.PersonType.objects.get_or_create( + txt_idx='administrator', defaults={'label': 'Admin'}) + user, created = User.objects.get_or_create(username='myusername') + user.is_superuser = True + user.save() + ishtar_user = models.IshtarUser.objects.get(username=user.username) + self.assertIn(admin, ishtar_user.person.person_types.all()) + + class AdminGenTypeTest(TestCase): fixtures = [settings.ROOT_PATH + '../fixtures/initial_data-auth-fr.json', -- cgit v1.2.3