def test_is_staff_for_nonexistent_user(self): from karl.models.peopledirectory import is_staff from karl.testing import DummyUsers obj = _makeProfile() site = testing.DummyModel() site['testuser'] = obj site.users = DummyUsers() self.assertEqual(is_staff(obj, ()), ())
def test_is_staff_for_non_profile(self): from karl.models.peopledirectory import is_staff from karl.testing import DummyUsers obj = testing.DummyModel() site = testing.DummyModel() site['testuser'] = obj site.users = DummyUsers() site.users.add('testuser', 'testuser', '', []) self.assertEqual(is_staff(obj, ()), ())
def test_is_staff_for_staff(self): from karl.models.peopledirectory import is_staff from karl.testing import DummyUsers obj = _makeProfile() site = testing.DummyModel() site['testuser'] = obj site.users = DummyUsers() site.users.add('testuser', 'testuser', '', ['group.KarlStaff']) self.assertEqual(is_staff(obj, ()), True)