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.
This commit is contained in:
Loic Bistuer 2014-10-19 23:31:21 +07:00
parent 0fb83f1491
commit 968510e5d7
2 changed files with 16 additions and 16 deletions

View File

@ -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'))

16
tests/cache/tests.py vendored
View File

@ -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')