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)
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)
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)
def can_create_period(request): return request.has_permission(perms.CAN_CREATE_PERIOD, ClinicFactory(request))
def can_access_clinics(request): return request.has_permission(perms.CAN_ASSESS_CLINICS, ClinicFactory(request))
def is_super_user(request): return request.has_permission(perms.SUPER_USER, ClinicFactory(request))
def can_view_clinics(request): return request.has_permission(perms.CAN_VIEW_CLINICS, ClinicFactory(request))
def can_list_clinics(request): return request.has_permission(perms.CAN_LIST_CLINICS, ClinicFactory(request))