from django.test import TestCase

class AdminBasicTest(TestCase):
    def test_admin_loads(self):
        self.assertTrue(self.client.login(username='staff', password='123'))
        res = self.client.get('/admin/')
        self.assertEqual(res.status_code, 200)

    def test_permissions(self):
        self.assertTrue(self.client.login(username='staff', password='123'))
        res = self.client.get('/admin/')
        self.assertContains(res, 'Foos')
        self.assertNotContains(res, 'Bars')
        self.assertNotContains(res, 'Users')

        self.assertTrue(self.client.login(username='superuser', password='123'))
        self.assertContains(self.client.get('/admin/'), 'Users')

    def test_app_index(self):
        self.client.login(username='staff', password='123')
        res = self.client.get('/admin/test_app/foo/')
        self.assertEqual(res.status_code, 200)
        self.assertContains(res, 'Foos')
        self.assertNotContains(res, 'Bars')

        self.client.login(username='superuser', password='123')
        res = self.client.get('/admin/test_app/foo/')
        self.assertContains(res, 'Foos')
        self.assertContains(res, 'Bars')
@@ -627,36 +627,22 @@
         
-self.assertContains(
+res = 
 self.cli
@@ -659,26 +659,88 @@
 admin/')
-, 'Users')
+%0A        self.assertContains(res, 'Users', 2) # menu and dashboard items
 %0A%0A    de
@@ -862,36 +862,32 @@
 /admin/test_app/
-foo/
 ')%0A        self.
@@ -1121,12 +1121,8 @@
 app/
-foo/
 ')%0A 
@@ -1181,28 +1181,96 @@
 .assertContains(res, 'Bars')
+%0A        self.assertContains(res, 'Users', 1) # only item from menu%0A

Fix tests from previous commit