예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
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)
예제 #5
0
 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")
예제 #6
0
 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)
예제 #7
0
 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)
예제 #8
0
 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)