def testSetSubProviderResultList(self): provider = create_user(get_random_username(), "provider", "thj", "demo", "555 Bryant St.", "Palo Alto", "CA", "", uklass=Provider) provider.save() nppa = NP_PA(user=provider) nppa.save() provider1 = create_user(get_random_username(), "physician", "thj", "demo", "555 Bryant St.", "Palo Alto", "CA", "", uklass=Provider) provider1.save() phy = Physician(user=provider1) phy.specialty = 'AC' phy.save() self.assertEqual(0, len(setSubProviderResultList([], phy)), 'test failed for setSubProviderResultList') self.assertEqual(1, len(setSubProviderResultList([nppa], phy)), 'test failed for setSubProviderResultList') self.assertEqual(2, len(setSubProviderResultList([nppa, phy])), 'test failed for setSubProviderResultList')
def testSetSubProviderResultList(self): provider = create_user(get_random_username(), "provider", "thj", "demo", "555 Bryant St.", "Palo Alto", "CA", "", uklass=Provider) provider.save() nppa = NP_PA(user=provider) nppa.save() provider1 = create_user(get_random_username(), "physician", "thj", "demo", "555 Bryant St.", "Palo Alto", "CA", "", uklass=Provider) provider1.save() phy = Physician(user=provider1) phy.specialty = 'AC' phy.save() self.assertEqual(0, len(setSubProviderResultList([], phy)), 'test failed for setSubProviderResultList') self.assertEqual(1, len(setSubProviderResultList([nppa], phy)), 'test failed for setSubProviderResultList') self.assertEqual(2, len(setSubProviderResultList([nppa, phy])), 'test failed for setSubProviderResultList')
def getPracticeProviders(practice_id): if not practice_id: raise Http404 try: practice = PracticeLocation.objects.get(pk=practice_id) rs = get_all_practice_providers(practice, False) data = {} data['users'] = setSubProviderResultList(rs) return data except PracticeLocation.DoesNotExist: raise Http404
def testGetPracticeProviders(self): practice = create_practice() rs = get_all_practice_providers(practice, False) data = {} data['users'] = setSubProviderResultList(rs) self.assertEqual(data, getPracticeProviders(practice.id)) with self.assertRaises(Http404): getPracticeProviders('') practice_ids = PracticeLocation.objects.filter().values_list('id', flat=True) not_exist_id = 1 while not_exist_id in practice_ids: not_exist_id += 1 with self.assertRaises(Http404): getPracticeProviders(not_exist_id)
def testGetSiteStaff(self): site = create_site() rs = get_all_site_providers(site) data = {} data['users'] = setSubProviderResultList(rs) self.assertEqual(data, getSiteStaff(site.id)) with self.assertRaises(Http404): getSiteStaff('') site_ids = Site.objects.filter().values_list('id', flat=True) not_exist_id = 1 while not_exist_id in site_ids: not_exist_id += 1 with self.assertRaises(Http404): getSiteStaff(not_exist_id)
def getSiteStudents(site_id): if not site_id: raise Http404 try: site = Site.objects.get(pk=site_id) rs = get_all_site_clinical_clerks(site) data = {} data['users'] = setSubProviderResultList(rs) return data except Site.DoesNotExist: raise Http404
def getSiteStudents(site_id): if not site_id: raise Http404 try: site = Site.objects.get(pk=site_id) rs = get_all_site_clinical_clerks(site) data = {} data['users'] = setSubProviderResultList(rs) return data except Site.DoesNotExist: raise Http404
def getPracticeProviders(practice_id): if not practice_id: raise Http404 try: practice = PracticeLocation.objects.get(pk=practice_id) rs = get_all_practice_providers(practice, False) data = {} data['users'] = setSubProviderResultList(rs) return data except PracticeLocation.DoesNotExist: raise Http404
def testGetPracticeStaff(self): practice = create_practice() rs = get_all_practice_staff(practice) data = {} data['users'] = setSubProviderResultList(rs) self.assertEqual(data, getPracticeStaff(practice.id)) with self.assertRaises(Http404): getPracticeStaff('') practice_ids = PracticeLocation.objects.filter().values_list('id', flat=True) not_exist_id = 1 while not_exist_id in practice_ids: not_exist_id += 1 with self.assertRaises(Http404): getPracticeStaff(not_exist_id)