def test_permission_denied_familly_no_access(self): with self.assertRaises(PermissionDenied): request = RequestFactory().get(reverse("auth:index")) request.user = self.family_member_no_access view = views.Index() view.setup(request) view.get(request)
def test_context_exists_superuser(self): request = RequestFactory().get(reverse("auth:index")) request.user = self.user view = views.Index() view.setup(request) self.assertEqual(view.get(request).status_code, 200) self.assertEqual( view.extra_context.get("child_care_facility"), self.cc_facility, ) self.assertEqual( view.extra_context.get("employee").username, self.user.username)
def test_context_exists_manager(self): request = RequestFactory().get(reverse("auth:index")) request.user = self.employee view = views.Index() view.setup(request) self.assertEqual(view.get(request).status_code, 200) self.assertEqual(view.extra_context.get("child_care_facility"), self.cc_facility) self.assertEqual( view.extra_context.get("employee").username, self.employee.username) self.assertEqual(view.extra_context.get("child_number"), 0) self.assertEqual(view.extra_context.get("events_today"), 0) self.assertEqual(view.extra_context.get("medical_event_today"), 0) self.assertEqual(view.extra_context.get("fill_ratio"), 0)
def test_index_page_exists_access_superuser_allowed(self): request = RequestFactory().get(reverse("auth:index")) request.user = self.user view = views.Index() view.setup(request) self.assertEqual(view.get(request).status_code, 200)
def test_index_page_uses_correct_template(self): request = RequestFactory().get(reverse("auth:index")) request.user = self.employee view = views.Index() view.setup(request) self.assertEqual(view.template_name, "auth_access_admin/_index.html")
def test_index_page_url_accessible_by_name(self): request = RequestFactory().get(reverse("auth:index")) request.user = self.employee view = views.Index() view.setup(request) self.assertEqual(view.get(request).status_code, 200)
def test_index_page_exists_access_manager_allowed(self): request = RequestFactory().get("auth:index") request.user = self.employee view = views.Index() view.setup(request) self.assertEqual(view.get(request).status_code, 200)
def test_index_page_exist(self): request = RequestFactory().get("auth/index/") request.user = self.employee view = views.Index() view.setup(request) self.assertEqual(view.get(request).status_code, 200)