diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index abd590ed40..051fc0ae8d 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -5180,3 +5180,19 @@ class AdminGenericRelationTests(TestCase): validator.validate_list_filter(GenericFKAdmin, Plot) except ImproperlyConfigured: self.fail("Couldn't validate a GenericRelation -> FK path in ModelAdmin.list_filter") + + +@override_settings(ROOT_URLCONF="admin_views.urls") +class TestEtagWithAdminView(TestCase): + # See https://code.djangoproject.com/ticket/16003 + + def test_admin(self): + with self.settings(USE_ETAGS=False): + response = self.client.get('/test_admin/admin/') + self.assertEqual(response.status_code, 302) + self.assertFalse(response.has_header('ETag')) + + with self.settings(USE_ETAGS=True): + response = self.client.get('/test_admin/admin/') + self.assertEqual(response.status_code, 302) + self.assertTrue(response.has_header('ETag')) diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 926136a587..6410e0b0be 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -2058,22 +2058,6 @@ class TestWithTemplateResponse(TestCase): self.assertTrue(response.has_header('ETag')) -@override_settings(ROOT_URLCONF="admin_views.urls") -class TestEtagWithAdmin(TestCase): - # See https://code.djangoproject.com/ticket/16003 - - def test_admin(self): - with self.settings(USE_ETAGS=False): - response = self.client.get('/test_admin/admin/') - self.assertEqual(response.status_code, 302) - self.assertFalse(response.has_header('ETag')) - - with self.settings(USE_ETAGS=True): - response = self.client.get('/test_admin/admin/') - self.assertEqual(response.status_code, 302) - self.assertTrue(response.has_header('ETag')) - - class TestMakeTemplateFragmentKey(TestCase): def test_without_vary_on(self): key = make_template_fragment_key('a.fragment')