From 968510e5d709ca83933fbff733a19437e469c10a Mon Sep 17 00:00:00 2001 From: Loic Bistuer Date: Sun, 19 Oct 2014 23:31:21 +0700 Subject: [PATCH] Moved a test case that caused deprecation warnings. `cache.tests.TestEtagWithAdmin` loaded views from the `admin_views` test package. This is problematic because when the `cache` test package is run in isolation, `admin_views` isn't in INSTALLED_APPS, and therefore loading its models isn't allowed since the app loading refactor. --- tests/admin_views/tests.py | 16 ++++++++++++++++ tests/cache/tests.py | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) 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')