def test_shared_403_decorator(self): """shared_403_decorator calls correct error handler""" response = self.client.get(reverse('raise-misago-403')) self.assertEqual(response.status_code, 403) response = self.client.get(reverse('raise-403')) self.assertContains(response, "Custom 403", status_code=403) response = mock_custom_403_error_page(self.misago_request) self.assertNotContains(response, "Custom 403", status_code=403) response = mock_custom_403_error_page(self.site_request) self.assertContains(response, "Custom 403", status_code=403)
def test_shared_403_decorator(self): """shared_403_decorator calls correct error handler""" response = self.client.get(reverse('raise-misago-403')) self.assertEqual(response.status_code, 403) response = self.client.get(reverse('raise-403')) self.assertContains(response, "Custom 403", status_code=403) response = mock_custom_403_error_page(self.misago_request, PermissionDenied()) self.assertNotContains(response, "Custom 403", status_code=403) response = mock_custom_403_error_page(self.site_request, PermissionDenied()) self.assertContains(response, "Custom 403", status_code=403)
def test_shared_403_decorator(self): """shared_403_decorator calls correct error handler""" response = self.client.get(reverse('raise_misago_403')) self.assertEqual(response.status_code, 403) response = self.client.get(reverse('raise_403')) self.assertEqual(response.status_code, 403) self.assertIn("Custom 403", response.content) response = mock_custom_403_error_page(self.misago_request) self.assertNotIn("Custom 403", response.content) response = mock_custom_403_error_page(self.site_request) self.assertIn("Custom 403", response.content)