@@ -0,0 +1,1864 @@
+from django.test import TestCase%0A%0Afrom login.tests.scenario import (%0A    get_user_staff,%0A    get_user_web,%0A)%0A%0A%0Aclass PermTestCase(TestCase):%0A%0A    def assert_any(self, url):%0A        self.client.logout()%0A        response = self.client.get(url)%0A        self.assertEqual(%0A            response.status_code,%0A            200,%0A            %22status %7B%7D: everyone should not have access to '%7B%7D'%22.format(%0A                response.status_code, url%0A            )%0A        )%0A%0A    def assert_staff_only(self, url):%0A        self._assert_no_perm(url)%0A        self._assert_no_web(url)%0A        self._assert_staff(url)%0A%0A    def _assert_no_perm(self, url):%0A        self.client.logout()%0A        response = self.client.get(url)%0A        self.assertEqual(%0A            response.status_code,%0A            302,%0A            %22status %7B%7D: no user login - %22%0A            %22so should not have access to '%7B%7D'%22.format(%0A                response.status_code, url%0A            )%0A        )%0A%0A    def _assert_no_web(self, url):%0A        web = get_user_web()%0A        self.client.login(%0A            username=web.username, password=web.username%0A        )%0A        response = self.client.get(url)%0A        self.assertEqual(%0A            response.status_code,%0A            302,%0A            %22status %7B%7D: user '%7B%7D' should not have access %22%0A            %22to this url: '%7B%7D'%22.format(%0A                response.status_code, web.username, url%0A            )%0A        )%0A%0A    def _assert_staff(self, url):%0A        staff = get_user_staff()%0A        self.client.login(%0A            username=staff.username, password=staff.username%0A        )%0A        response = self.client.get(url)%0A        self.assertEqual(%0A            response.status_code,%0A            200,%0A            %22status %7B%7D: staff user '%7B%7D' should have access %22%0A            %22to this url: '%7B%7D'%22.format(%0A                response.status_code, staff.username, url%0A            )%0A        )%0A

test class for checking permissions