Example #1
0
    def test_get_item_raises_key_error_if_bad_int(self):
        # invalid user id
        clinic_id = "abc"

        request = testing.DummyRequest()
        self.assertRaises(KeyError,
                          ClinicFactory(request).__getitem__, clinic_id)
Example #2
0
    def test_get_item_raises_key_error_if_id_doesnt_exist(self):
        # invalid user id
        clinic_id = -1

        request = testing.DummyRequest()
        self.assertRaises(KeyError,
                          ClinicFactory(request).__getitem__, clinic_id)
Example #3
0
    def test_get_item_returns_clinic_if_id_exists(self):
        self.setup_test_data()
        clinic = Clinic.newest()

        request = testing.DummyRequest()
        clinic = ClinicFactory(request).__getitem__(clinic.id)
        self.assertIsInstance(clinic, Clinic)
Example #4
0
def can_create_period(request):
    return request.has_permission(perms.CAN_CREATE_PERIOD,
                                  ClinicFactory(request))
Example #5
0
def can_access_clinics(request):
    return request.has_permission(perms.CAN_ASSESS_CLINICS,
                                  ClinicFactory(request))
Example #6
0
def is_super_user(request):
    return request.has_permission(perms.SUPER_USER,
                                  ClinicFactory(request))
Example #7
0
def can_view_clinics(request):
    return request.has_permission(perms.CAN_VIEW_CLINICS,
                                  ClinicFactory(request))
Example #8
0
def can_list_clinics(request):
    return request.has_permission(perms.CAN_LIST_CLINICS,
                                  ClinicFactory(request))