summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Sorrel <thomas@pandeiro.fr>2013-07-21 11:02:36 +0200
committerJulien Phalip <jphalip@gmail.com>2013-07-21 20:17:14 +0000
commitbb145e2c47d71b7f68280c00ced727442d2effa2 (patch)
tree89094accfccd92ec9c9b8cd73f590b0702603304 /tests
parent11b7b9ad0040cbe78d17514373475ee41179d3fa (diff)
Fixed #13629 -- Added CSS classes to the `<body>` tag of some admin templates to allow style customizations per app or per model.
Diffstat (limited to 'tests')
-rw-r--r--tests/admin_views/tests.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index a83c756a25..7decf6f471 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -3824,6 +3824,59 @@ class CSSTest(TestCase):
self.assertContains(response, '<tr class="model-actor">')
self.assertContains(response, '<tr class="model-album">')
+ def testAppModelInFormBodyClass(self):
+ """
+ Ensure app and model tag are correcly read by change_form template
+ """
+ response = self.client.get('/test_admin/admin/admin_views/section/add/')
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response,
+ '<body class="app-admin_views model-section ')
+
+ def testAppModelInListBodyClass(self):
+ """
+ Ensure app and model tag are correcly read by change_list template
+ """
+ response = self.client.get('/test_admin/admin/admin_views/section/')
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response,
+ '<body class="app-admin_views model-section ')
+
+ def testAppModelInDeleteConfirmationBodyClass(self):
+ """
+ Ensure app and model tag are correcly read by delete_confirmation
+ template
+ """
+ response = self.client.get(
+ '/test_admin/admin/admin_views/section/1/delete/')
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response,
+ '<body class="app-admin_views model-section ')
+
+ def testAppModelInAppIndexBodyClass(self):
+ """
+ Ensure app and model tag are correcly read by app_index template
+ """
+ response = self.client.get('/test_admin/admin/admin_views/')
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response, '<body class="app-admin_views ')
+
+ def testAppModelInDeleteSelectedConfirmationBodyClass(self):
+ """
+ Ensure app and model tag are correcly read by
+ delete_selected_confirmation template
+ """
+ action_data = {
+ ACTION_CHECKBOX_NAME: [1],
+ 'action': 'delete_selected',
+ 'index': 0,
+ }
+ response = self.client.post('/test_admin/admin/admin_views/section/',
+ action_data)
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response,
+ '<body class="app-admin_views model-section ')
+
try:
import docutils
except ImportError: