def test_get_with_superuser(self): """Test GET with superuser.""" view = ManageProjects.as_view() self.request.user = UserFactory.create(**{"is_superuser": True}) response = view(self.request).render() self.assertEqual(response.status_code, 200)
def test_get_with_anonymous(self): """Test GET with anonymous user.""" view = ManageProjects.as_view() self.request.user = AnonymousUser() response = view(self.request) self.assertTrue(isinstance(response, HttpResponseRedirect))
def test_get_with_superuser(self): """Test GET with superuser.""" view = ManageProjects.as_view() self.request.user = UserFactory.create(**{'is_superuser': True}) response = view(self.request).render() self.assertEqual(response.status_code, 200)
def test_get_with_anonymous(self): """Test GET with anonymous user.""" view = ManageProjects.as_view() self.request.user = AnonymousUser() response = view(self.request) self.assertTrue(isinstance(response, HttpResponseRedirect))
def test_get_with_user(self): """Test GET with user.""" view = ManageProjects.as_view() self.request.user = UserFactory.create(**{"is_superuser": False}) response = view(self.request).render() self.assertEqual(response.status_code, 200) self.assertContains(response, "No rights to access superuser tools.")
def test_get_with_user(self): """Test GET with user.""" view = ManageProjects.as_view() self.request.user = UserFactory.create(**{'is_superuser': False}) response = view(self.request).render() self.assertEqual(response.status_code, 200) self.assertContains(response, 'No rights to access superuser tools.')