本文整理汇总了Python中MHLogin.MHLPractices.models.PracticeLocation类的典型用法代码示例。如果您正苦于以下问题:Python PracticeLocation类的具体用法?Python PracticeLocation怎么用?Python PracticeLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PracticeLocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testCheckProviderSchedule
def testCheckProviderSchedule(self):
response = self.client.get(reverse('MHLogin.MHLOrganization.views_member.checkProviderSchedule'),\
data={'org_id': self.practice.id,'prov_id':self.provider.user.id})
self.assertEqual(response.status_code, 200)
msg = json.loads(response.content)
self.assertEqual(len(msg), 1)
self.call_group = CallGroup.objects.create(description='test', team='team')
organization = PracticeLocation(practice_name='testcallgroup',
practice_longit='0.1',
practice_lat='0.0',
call_group = self.call_group,)
organization.save()
self.organization = organization
response = self.client.get(reverse('MHLogin.MHLOrganization.views_member.checkProviderSchedule'),\
data={'org_id': self.practice.id})
self.assertEqual(response.status_code, 200)
msg = json.loads(response.content)
self.assertEqual(len(msg), 2)
response = self.client.get(reverse('MHLogin.MHLOrganization.views_member.checkProviderSchedule'),\
data={'org_id': self.practice.id,'prov_id':self.provider.user.id})
self.assertEqual(response.status_code, 200)
msg = json.loads(response.content)
self.assertEqual(len(msg), 1)
response = self.client.post(reverse('MHLogin.MHLOrganization.views_member.checkProviderSchedule'),\
data={'org_id': self.practice.id,'prov_id':self.provider.user.id})
self.assertEqual(response.status_code, 200)
msg = json.loads(response.content)
self.assertEqual(len(msg), 1)
示例2: test_canAccessCallGroup
def test_canAccessCallGroup(self):
call_group = CallGroup(description='test', team='team')
call_group.save()
practice = PracticeLocation(practice_name='test',
practice_longit='0.1',
practice_lat='0.0',
call_group=call_group)
practice.save()
practice.call_groups.add(call_group)
user = create_user('user-CallGroup2', 'us', 'er', 'demo')
staff = OfficeStaff(user=user)
staff.save()
staff.practices.add(practice)
#a staff call this method
result = canAccessCallGroup(staff, long(call_group.pk))
self.assertEqual(result, False)
#a manager call this method
# manager = Office_Manager(user=staff, practice=practice, manager_role=1)
# manager.save()
#
# result = canAccessCallGroup(manager, long(call_group.pk))
# self.assertEqual(result, True)
#admin call this method
admin = create_user('user-CallGroup', 'us', 'er', 'demo', '', '', '', '', Administrator)
result = canAccessCallGroup(admin.user, call_group)
self.assertEqual(result, True)
Administrator.objects.all().delete()
示例3: test_getLevelByStaff
def test_getLevelByStaff(self):
practice = PracticeLocation(
practice_address1='555 Pleasant Pioneer Grove',
practice_address2='Trailer Q615',
practice_city='Mountain View',
practice_state='CA',
practice_zip='94040-4104',
practice_lat=37.36876,
practice_longit= -122.081864)
practice.save()
user = create_user('practicemgr1', 'lin', 'xing', 'demo')
#not a manager login
result = get_level_by_staff(user, practice)
self.assertEqual(result, 0)
staff = OfficeStaff(user=user)
staff.save()
manager = Office_Manager(user=staff, practice=practice, manager_role=2)
manager.save()
#a manager login
result = get_level_by_staff(staff.id, practice)
self.assertEqual(result, 2)
示例4: test_checkoutUserManager
def test_checkoutUserManager(self):
practice = PracticeLocation(practice_name='test', practice_longit='0.1', practice_lat='0.0',)
practice.save()
user = create_user('staff', 'lin', 'xing', 'demo', '', '', '', '',)
staff = OfficeStaff(user=user)
staff.save()
staff.practices.add(practice)
provider = Provider.objects.create(username='healmeister', first_name='heal',
last_name='meister', address1="555 Bryant St.", city="Palo Alto", state="CA",
lat=0.0, longit=0.0, office_lat=0.0, office_longit=0.0, is_active=True,
tos_accepted=True, mobile_confirmed=True, mdcom_phone='123', mobile_phone='456')
provider.user = provider # for our unique prov-user reln
provider.save()
# try provider
result = user_is_mgr_of_practice(provider, practice)
self.assertEqual(False, result)
# try just staff
result = user_is_mgr_of_practice(staff.user, practice)
self.assertEqual(False, result)
# now office manager (make staff an OM)
om = Office_Manager.objects.create(user=staff, practice=practice, manager_role=1)
result = user_is_mgr_of_practice(om.user.user, practice)
self.assertEqual(True, result)
result = user_is_mgr_of_practice(staff.user, practice)
self.assertEqual(True, result)
示例5: testPracticeManage
def testPracticeManage(self):
practice = PracticeLocation(practice_name='test',
practice_longit='0.1',
practice_lat='0.0',)
practice.save()
self.user.current_practice = practice
self.user.practices.add(practice)
self.user.save()
response = self.client.get(reverse\
('MHLogin.api.v1.views_account.practiceManage'), **self.extra)
self.assertEqual(response.status_code, 200, response.status_code)
msg = json.loads(response.content)
self.assertEqual(len(msg), 2)
response = self.client.post(reverse\
('MHLogin.api.v1.views_account.practiceManage'), **self.extra)
self.assertEqual(response.status_code, 200, response.status_code)
msg = json.loads(response.content)
self.assertEqual(len(msg), 2)
response = self.client.post(reverse\
('MHLogin.api.v1.views_account.practiceManage'), data={'current_practice':practice.id}, **self.extra)
self.assertEqual(response.status_code, 200, response.status_code)
msg = json.loads(response.content)
self.assertEqual(len(msg), 2)
示例6: test_isCallGroupStaff
def test_isCallGroupStaff(self):
call_group = CallGroup(description='test', team='team')
call_group.save()
practice = PracticeLocation(practice_name='test',
practice_longit='0.1',
practice_lat='0.0',)
practice.call_group = call_group
practice.save()
user = create_user('user5', 'us', 'er', 'demo')
#a mhluser call this method
result = isCallGroupStaff(user, call_group.pk)
self.assertEqual(result, False)
staff = OfficeStaff(user=user)
staff.save()
staff.practices.add(practice)
#a staff call this method
result = isCallGroupStaff(user, call_group.pk)
self.assertEqual(result, True)
#a manager call this method
manager = Office_Manager(user=staff, practice=practice, manager_role=1)
manager.save()
result = isCallGroupStaff(user, call_group.pk)
self.assertEqual(result, True)
示例7: test_getCurrentPractice
def test_getCurrentPractice(self):
practice = PracticeLocation(practice_name='test',
practice_longit='0.1',
practice_lat='0.0',)
practice.save()
user = create_user('practicemgr1', 'lin', 'xing', 'demo')
#a mhluser login and call this method
result = getCurrentPractice(user)
self.assertEqual(result, '')
#a provider login and call this method
provider = Provider(username='provider', first_name='tes', last_name="meister", email='[email protected]',
user=user, office_lat=0.0, office_longit=0.0)
provider.current_practice = practice
provider.save()
result = getCurrentPractice(user)
self.assertEqual(result, 'test')
#a staff login and call this method
staff = OfficeStaff(user=user)
staff.current_practice = practice
staff.save()
result = getCurrentPractice(user)
self.assertEqual(result, 'test')
示例8: test_get_all_providers_and_staffs
def test_get_all_providers_and_staffs(self):
request = generateHttpRequest()
#get method
request.method = 'GET'
result = get_all_providers_and_staffs(request)
self.assertEqual(result.status_code, 400)
msg = json.loads(result.content)
self.assertEqual(msg['errno'], 'GE002')
#post method
request.method = 'POST'
#find 0 any type user
result = get_all_providers_and_staffs(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['users']), 0)
#has 1 nppa
user = create_user('np1', 'abc', '', 'demo')
provider = Provider(user=user, username='p1', first_name='abc', last_name='',
office_lat=0.0, office_longit=0.0)
provider.save()
nppa = NP_PA(user=provider)
nppa.save()
request.POST['name'] = unicode('abc')
result = get_all_providers_and_staffs(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['users']), 1)
self.assertEqual(msg['users'][0]['first_name'], 'abc')
phy = Physician(user=provider)
phy.save()
result = get_all_providers_and_staffs(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['users']), 2)
self.assertEqual(msg['users'][0]['first_name'], 'abc')
#staff
organization_type = create_org_type()
practice = PracticeLocation(practice_name='test',
practice_longit='0.1',
practice_lat='0.0',
mdcom_phone='8005550085',
organization_type=organization_type)
practice.save()
staff = OfficeStaff(user=request.user, current_practice=practice)
staff.save()
staff.practices.add(practice)
request.POST['name'] = unicode(request.user.first_name)
result = get_all_providers_and_staffs(request)
self.assertEqual(result.status_code, 200)
self.assertEqual(len(msg['users']), 2)
self.assertEqual(msg['users'][0]['first_name'], 'abc')
示例9: test_convert_dt_to_utz
def test_convert_dt_to_utz(self):
local_tz = 'America/New_York'
practice = PracticeLocation()
practice.time_zone = local_tz
dt = datetime(2013, 01, 29)
local_tz = timezone(local_tz)
local_dt = timezone(settings.TIME_ZONE).localize(dt, is_dst=None)
cmp_dt = local_dt.astimezone(local_tz).replace(tzinfo=None)
self.assertEqual(cmp_dt, convert_dt_to_utz(dt, self.mhluser, practice))
示例10: testPracticeStaff
def testPracticeStaff(self):
practice = PracticeLocation(practice_name = "pyang",practice_address1="Palo Alto",\
practice_longit = 0.0,practice_lat = 0.0)
practice.save()
response = self.client.get\
(reverse('MHLogin.api.v1.views_practices.practiceStaff',\
args=(practice.id,)), **self.extra)
self.assertEqual(response.status_code, 200, response.status_code)
示例11: testMyPracticeStaff
def testMyPracticeStaff(self):
practice = PracticeLocation(practice_name = "pyang",practice_address1="Palo Alto",\
practice_longit = 0.0,practice_lat = 0.0)
practice.save()
data = {
'id': practice.id
}
response = self.client.post(reverse\
('MHLogin.api.v1.views_practices.myPracticeStaff'), data, **self.extra)
self.assertEqual(response.status_code, 200, response.status_code)
示例12: testProfile
def testProfile(self):
phys = Physician(user = self.user)
phys.save()
data = {
'username':get_random_username(),
'first_name':'c',
'last_name':'tian',
'mobile_phone':9001111111,
'gender':'M',
'old_email':'[email protected]',
'email':'[email protected]',
'lat':0.0,
'longit':0.0,
'address1':'address1',
'address2':'address2',
'city':'Chicago',
'state':'IL',
'zip':60601,
'user_type':1,
'office_lat':41.885805,
'office_longit':-87.6229106,
}
response = self.client.post(reverse\
('MHLogin.api.v1.views_account.profile'), data,**self.extra)
self.assertEqual(response.status_code, 200, response.status_code)
msg = json.loads(response.content)
self.assertEqual(len(msg), 2)
site = Site(
name='mysite',
address1='555 Pleasant Pioneer Grove',
address2='Trailer Q615',
city='Mountain View',
state='CA',
zip='94040-4104',
lat=37.36876,
longit=-122.081864,
short_name='MSite'
)
site.save()
practice = PracticeLocation(practice_name='test',
practice_longit='0.1',
practice_lat='0.0',)
practice.save()
self.user.current_site = site
self.user.current_practice = practice
self.user.save()
response = self.client.get(reverse\
('MHLogin.api.v1.views_account.profile'), data,**self.extra)
self.assertEqual(response.status_code, 200, response.status_code)
msg = json.loads(response.content)
self.assertEqual(len(msg), 2)
示例13: GetSubTypesICanUseTest
class GetSubTypesICanUseTest(TestCase):
org_type = None
admin = None
manager = None
organization = None
def setUp(self):
clean_db_datas()
OrganizationType.objects.all().delete()
org_setting = OrganizationSetting()
org_setting.save()
self.org_type = OrganizationType(name="Test Org Type1",
organization_setting=org_setting, is_public=True)
# TODO: issue 2030, reserved id's is a hazardous approach, the UT's
# were working with SQLlite but not with MySQL, DB engines recycle
# id's differently and we should not rely on reserved id fields. This
# should be addressed in a separate Redmine as model changes may occur.
self.org_type.id = RESERVED_ORGANIZATION_TYPE_ID_PRACTICE
self.org_type.save()
self.organization = create_organization()
self.organization = PracticeLocation(
practice_name=get_random_username(),
practice_address1='555 Pleasant Pioneer Grove',
practice_address2='Trailer Q615',
practice_city='Mountain View',
practice_state='CA',
practice_zip='94040-4104',
practice_lat=37.36876,
practice_longit=-122.081864)
self.organization.save()
self.admin = create_user('admin', 'Morris', 'Kelly', 'demo', uklass=Administrator)
staff = create_user('practicemgr1', 'Practice', 'Mgr', 'demo', uklass=OfficeStaff)
staff.practices.add(self.organization)
staff.save()
self.manager = Office_Manager(user=staff, practice=self.organization, manager_role=1)
self.manager.save()
def test_get_sub_types_I_can_use_empty(self):
self.assertEqual(0, len(get_sub_types_by_typeid(self.org_type.id)))
def test_get_sub_types_I_can_use(self):
create_multiple_organization_types(self.org_type, num=10)
self.assertEqual(10, len(get_sub_types_by_typeid(self.org_type.id)))
create_multiple_organization_types(self.org_type, num=10, is_public=False)
self.assertEqual(10, len(get_sub_types_by_typeid(self.org_type.id)))
self.assertEqual(0, len(get_sub_types_by_typeid(self.org_type.id, is_public=True)))
def tearDown(self):
pass
示例14: create_practice
def create_practice():
practice = PracticeLocation(
practice_name='USA practice',
practice_address1='555 Pleasant Pioneer Grove',
practice_address2='Trailer Q615',
practice_city='Mountain View',
practice_state='CA',
practice_zip='94040-4104',
practice_lat=37.36876,
practice_longit=-122.081864)
practice.save()
return practice
示例15: setUpClass
def setUpClass(cls):
clean_db_datas()
organization_type = create_org_type()
practice = PracticeLocation(practice_name='test',
practice_longit='0.1',
practice_lat='0.0',
mdcom_phone='8005550085',
organization_type=organization_type)
practice.save()
cls.practice = practice
user = create_user('practicemgr1', 'lin', 'xing', 'demo')
cls.user = user