def test_no_apps(self): apps = get_app_list(User.objects.get(pk=4)) self.assertEqual(len(apps), 0)
def test_all_apps(self): u = User.objects.get(pk=2) AppPermission.objects.assign("rubberstamp.manage.testapp.testmodel", u) apps = get_app_list(u) self.assertEqual(len(apps), 2) self.assertTrue(all(a in apps for a in ["testapp", "rubberstamp"]))
def test_one_app(self): """A list of one item when user has perm in one app.""" apps = get_app_list(User.objects.get(pk=2)) self.assertEqual(len(apps), 1) self.assertTrue("testapp" in apps)