def test_default_access_fn_invalid_url_name(self): with self.assertRaises(NoReverseMatch): default_access_fn(self.staff_user, 'invalid_module:index')
def test_default_access_non_dashboard_url_name(self): assert reverse('search:search') with self.assertRaises(KeyError): default_access_fn(self.staff_user, 'search:search')
def test_default_access_fn_staff(self): self.assertTrue(default_access_fn(self.staff_user, 'dashboard:index'))
def test_default_access_fn_non_staff_user(self): self.assertFalse( default_access_fn(self.non_staff_user, 'dashboard:index'))
def test_default_access_non_dashboard_url_name(self): assert reverse('search:search') self.assertFalse(default_access_fn(self.staff_user, 'search:search'))
def test_default_access_fn_no_url_name(self): self.assertTrue(default_access_fn(self.staff_user, None))
def test_default_access_fn_invalid_url_name(self): self.assertFalse( default_access_fn(self.staff_user, 'invalid_module:index'))
def test_default_access_fn_invalid_url_name(self): self.assertFalse(default_access_fn(self.staff_user, 'invalid_module:index'))
def test_default_access_fn_non_staff_user(self): self.assertFalse(default_access_fn(self.non_staff_user, 'dashboard:index'))
def test_default_access_fn_staff(self): self.assertTrue(default_access_fn(self.staff_user, 'dashboard:index'))
def test_default_access_fn_no_url_name(self): self.assertTrue(default_access_fn(self.staff_user, None))