Fixed #21774 -- Isolate all test urls from eachother.

This (nearly) completes the work to isolate all the test modules from
each other. This is now more important as importing models from another
module will case PendingDeprecationWarnings if those modules are not in
INSTALLED_APPS. The only remaining obvious dependencies are:

- d.c.auth depends on d.c.admin (because of the is_admin flag to some
  views), but this is not so important and d.c.admin is in
  always_installed_apps
- test_client_regress depends on test_client. Eventually these should
  become a single module, as the split serves no useful purpose.
This commit is contained in:
Marc Tamlyn 2014-01-14 15:43:27 +00:00
parent ac8d0a4815
commit 2607fa9016
24 changed files with 397 additions and 350 deletions

View file

@ -16,6 +16,7 @@ class AdminCustomUrlsTest(TestCase):
* The ModelAdmin for Action customizes the add_view URL, it's
'<app name>/<model name>/!add/'
"""
urls = 'admin_custom_urls.urls'
fixtures = ['users.json', 'actions.json']
def setUp(self):
@ -28,7 +29,7 @@ class AdminCustomUrlsTest(TestCase):
"""
Ensure GET on the add_view works.
"""
response = self.client.get('/custom_urls/admin/admin_custom_urls/action/!add/')
response = self.client.get('/admin/admin_custom_urls/action/!add/')
self.assertIsInstance(response, TemplateResponse)
self.assertEqual(response.status_code, 200)
@ -37,7 +38,7 @@ class AdminCustomUrlsTest(TestCase):
Ensure GET on the add_view plus specifying a field value in the query
string works.
"""
response = self.client.get('/custom_urls/admin/admin_custom_urls/action/!add/', {'name': 'My Action'})
response = self.client.get('/admin/admin_custom_urls/action/!add/', {'name': 'My Action'})
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'value="My Action"')
@ -50,7 +51,7 @@ class AdminCustomUrlsTest(TestCase):
"name": 'Action added through a popup',
"description": "Description of added action",
}
response = self.client.post('/custom_urls/admin/admin_custom_urls/action/!add/', post_data)
response = self.client.post('/admin/admin_custom_urls/action/!add/', post_data)
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'dismissAddAnotherPopup')
self.assertContains(response, 'Action added through a popup')
@ -61,7 +62,7 @@ class AdminCustomUrlsTest(TestCase):
"""
# Should get the change_view for model instance with PK 'add', not show
# the add_view
response = self.client.get('/custom_urls/admin/admin_custom_urls/action/add/')
response = self.client.get('/admin/admin_custom_urls/action/add/')
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'Change action')
@ -84,6 +85,7 @@ class AdminCustomUrlsTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class CustomRedirects(TestCase):
urls = 'admin_custom_urls.urls'
fixtures = ['users.json', 'actions.json']
def setUp(self):