def test_context_user(self): request = self.factory.get(reverse("admin:index")) request.user = self._create_user() app_list = dashboard_app_list({"request": request}) # The AppLink is shown to everyone. There are no permissions set. self.assertEqual(len(app_list), 1)
def test_context_superuser_with_show_true(self): self.assertTrue(settings.SHOW_REMAINING_APPS_TO_SUPERUSERS) request = self.factory.get(reverse("admin:index")) request.user = self.superuser app_list = dashboard_app_list({"request": request}) self.assertEqual(len(app_list), 2)
def test_context_staffuser_with_show_true(self): request = self.factory.get(reverse("admin:index")) user = self._create_user(is_staff=True) user.user_permissions.add(*Permission.objects.all()) request.user = user app_list = dashboard_app_list({"request": request}) self.assertEqual(len(app_list), 2)
def test_context_staff_user_with_show_false(self): self.assertFalse(settings.SHOW_REMAINING_APPS) request = self.factory.get(reverse("admin:index")) user = self._create_user(is_staff=True) user.user_permissions.add(*Permission.objects.all()) request.user = user app_list = dashboard_app_list({"request": request}) self.assertEqual(len(app_list), 1)
def test_context_superuser_with_show_false(self): request = self.factory.get(reverse("admin:index")) request.user = self.superuser app_list = dashboard_app_list({"request": request}) self.assertEqual(len(app_list), 1)
def test_context_user(self): request = self.factory.get(reverse("admin:index")) request.user = self._create_user() app_list = dashboard_app_list({"request": request}) self.assertEqual(len(app_list), 0)