Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added a test to show that the user.is_staff check in admin base.html …

…is necessary.

refs #21067
  • Loading branch information...
commit aeed2cf3b23161f228c8b221e56ea4d8a7cf71aa 1 parent 28a5713
Tim Graham authored September 09, 2013

Showing 1 changed file with 13 additions and 0 deletions. Show diff stats Hide diff stats

  1. 13  tests/admin_views/tests.py
13  tests/admin_views/tests.py
@@ -1296,6 +1296,19 @@ def testDisabledPermissionsWhenLoggedIn(self):
1296 1296
         response = self.client.get('/test_admin/admin/secure-view/')
1297 1297
         self.assertContains(response, 'id="login-form"')
1298 1298
 
  1299
+    def testDisabledStaffPermissionsWhenLoggedIn(self):
  1300
+        self.client.login(username='super', password='secret')
  1301
+        superuser = User.objects.get(username='super')
  1302
+        superuser.is_staff = False
  1303
+        superuser.save()
  1304
+
  1305
+        response = self.client.get('/test_admin/admin/')
  1306
+        self.assertContains(response, 'id="login-form"')
  1307
+        self.assertNotContains(response, 'Log out')
  1308
+
  1309
+        response = self.client.get('/test_admin/admin/secure-view/')
  1310
+        self.assertContains(response, 'id="login-form"')
  1311
+
1299 1312
 
1300 1313
 @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
1301 1314
 class AdminViewsNoUrlTest(TestCase):

0 notes on commit aeed2cf

Please sign in to comment.
Something went wrong with that request. Please try again.