本文整理汇总了Python中MHLogin.MHLUsers.models.OfficeStaff.save方法的典型用法代码示例。如果您正苦于以下问题:Python OfficeStaff.save方法的具体用法?Python OfficeStaff.save怎么用?Python OfficeStaff.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MHLogin.MHLUsers.models.OfficeStaff
的用法示例。
在下文中一共展示了OfficeStaff.save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_display_scheduler_403
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def test_display_scheduler_403(self):
data403 = {}
staff = OfficeStaff(user=self.user)
staff.save()
response = self.client.get(reverse('MHLogin.MHLCallGroups.Scheduler.views.display_scheduler',
args=(self.call_group.id,)), data=data403)
self.assertEqual(response.status_code, 403)
示例2: test_new_event
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def test_new_event(self):
staff = OfficeStaff(user=self.user)
staff.save()
staff.practices.add(self.practice)
staff.current_practice = self.practice
staff.save()
manager = Office_Manager(user=staff, practice=self.practice, manager_role=1)
manager.save()
#get method
response = self.client.get(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.bulkNewEvents',
args=(self.practice.id, self.call_group.id)))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "bulkOperation.html")
#post method
#not save new event,provider is not in the call group
provider = Provider(username='provider', first_name='tes', last_name="meister",
email='[email protected]', office_lat=0.0, office_longit=0.0)
provider.save()
checkString = 'Ca69J2X6l8'
newEventInvalidData = {'data': '[{"pk":null,"model":"Scheduler.evententry","fields":'\
'{"oncallPerson":"' + str(provider.id) + '","eventType":"0",'\
'"startDate":"2012-12-19 08:00:00","endDate":"2012-12-20 08:00:00",'\
'"checkString":"' + checkString + '"}}]',
'view': '{"name":"month","start":"2012-12-01 00:00:00","end":"2013-01-01 00:00:00"}'}
response = self.client.post(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.bulkNewEvents',
args=(self.practice.id, self.call_group.id)), data=newEventInvalidData)
self.assertEqual(response.status_code, 200)
msg = json.loads(response.content)
self.assertEqual(msg['error'][0], checkString + ', error saving new object')
#save new event, provider is in the call group
provider2 = Provider(username='provider2', first_name='tes', last_name="meister",
email='[email protected]', office_lat=0.0, office_longit=0.0)
provider2.save()
cgm = CallGroupMember(call_group=self.call_group, member=provider2, alt_provider=1)
cgm.save()
checkString = 'Ca69J2X6l8'
newEventInvalidData = {'data': '[{"pk":null,"model":"Scheduler.evententry","fields":{"oncallPerson":"' +
str(provider2.id) + '","eventType":"0","startDate":"2012-12-19 08:00:00","endDate":"2012-12-20 08:00:00",\
"checkString":"' + checkString + '"}}]',
'view': '{"name":"month","start":"2012-12-01 00:00:00","end":"2013-01-01 00:00:00"}'}
response = self.client.post(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.bulkNewEvents',
args=(self.practice.id, self.call_group.id)), data=newEventInvalidData)
self.assertEqual(response.status_code, 200)
self.assertEqual(EventEntry.objects.count(), 1)
#403
call_group2 = CallGroup(description='test2', team='team')
call_group2.save()
response = self.client.post(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.bulkNewEvents',
args=(self.practice.id, call_group2.id)), data=newEventInvalidData)
self.assertEqual(response.status_code, 403)
示例3: test_checkoutUserManager
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
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)
示例4: test_canAccessCallGroup
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
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()
示例5: test_isCallGroupStaff
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
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)
示例6: test_practice_info
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def test_practice_info(self):
organization_type = create_org_type()
practice = ct_practice('name', organization_type)
request = generateHttpRequest()
#a provider login
result = practice_info(request, practice.id)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(msg['data']['id'], practice.id)
#a staff login
staff = OfficeStaff(user=request.user)
staff.save()
manager = Office_Manager(user=staff, practice=practice, manager_role=2)
manager.save()
assn = SmartPhoneAssn.all_objects.get(device_id=request.REQUEST['DCOM_DEVICE_ID'])
assn.user_type = 100
assn.save(request)
#invalid practice
result = practice_info(request, 0)
self.assertEqual(result.status_code, 400)
msg = json.loads(result.content)
self.assertEqual(msg['errno'], 'PF003')
#valid practice
result = practice_info(request, practice.id)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(msg['data']['id'], practice.id)
示例7: test_getMembers
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def test_getMembers(self):
staff = OfficeStaff(user=self.user)
staff.save()
staff.practices.add(self.practice)
staff.current_practice = self.practice
staff.save()
manager = Office_Manager(user=staff, practice=self.practice, manager_role=1)
manager.save()
#0 member found
response = self.client.post(reverse('MHLogin.MHLCallGroups.views.getMembers', args=(self.call_group.id,)))
self.assertEqual(response.status_code, 200)
#1 member found
provider = Provider(username='provider', first_name='tes', last_name="meister", email='[email protected]',
office_lat=0.0, office_longit=0.0)
provider.save()
member = CallGroupMember(call_group=self.call_group, member=provider, alt_provider=1)
member.save()
response = self.client.post(reverse('MHLogin.MHLCallGroups.views.getMembers', args=(self.call_group.id,)))
self.assertEqual(response.status_code, 200)
msg = json.loads(response.content)
self.assertEqual(len(msg), 1)
self.assertEqual(msg[0][0], provider.id)
#403
call_group2 = CallGroup(description='test2', team='team')
call_group2.save()
response = self.client.post(reverse('MHLogin.MHLCallGroups.views.getMembers', args=(call_group2.id,)))
self.assertEqual(response.status_code, 403)
示例8: test_local_office
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def test_local_office(self):
request = generateHttpRequest()
#a provider call this method
result = local_office(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['data']['practices']), 0)
#a office manager login but has not current practice
organization_type = create_org_type()
practice = ct_practice('name', organization_type)
staff = OfficeStaff(user=request.user)
staff.save()
manager = Office_Manager(user=staff, practice=practice, manager_role=2)
manager.save()
assn = SmartPhoneAssn.all_objects.get(device_id=request.REQUEST['DCOM_DEVICE_ID'])
assn.user_type = 100
assn.save(request)
result = local_office(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['data']['practices']), 0)
#a office manager login and has current practice
staff.current_practice = practice
result = local_office(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['data']['practices']), 0)
示例9: test_getLevelByStaff
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
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)
示例10: test_getCurrentPractice
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
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')
示例11: test_site_staff
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def test_site_staff(self):
request = generateHttpRequest()
staff = OfficeStaff(user=request.user)
staff.save()
assn = SmartPhoneAssn.all_objects.get(device_id=request.REQUEST['DCOM_DEVICE_ID'])
assn.user_type = 101
assn.save(request)
#staff has not current site
result = site_staff(request)
self.assertEqual(result.status_code, 200)
current_site = Site(name='test site', address1='test address', lat=0.0, longit=0.1)
current_site.save()
staff.current_site = current_site
staff.save()
#staff has current site
result = site_staff(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['data']['users']), 0)
#return_python == true
result = site_staff(request, True)
msg = result['data']['users']
self.assertEqual(len(msg), 0)
示例12: test_getEvents
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def test_getEvents(self):
staff = OfficeStaff(user=self.user)
staff.save()
staff.practices.add(self.practice)
manager = Office_Manager(user=staff, practice=self.practice, manager_role=2)
manager.save()
errData = {}
successDate = {'fromDate': datetime.datetime(2012, 12, 12), 'toDate': datetime.datetime(2012, 12, 17)}
#get method
response = self.client.get(reverse('MHLogin.MHLCallGroups.Scheduler.'\
'views_multicallgroup.getEvents', args=(self.practice.id, self.group.id)), data=successDate)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'DateEntry.html')
#error data
response = self.client.post(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.getEvents',
args=(self.practice.id, self.group.id)), data=errData)
self.assertEqual(response.status_code, 403)
#error call group
group2 = CallGroup(description='test', team='team')
group2.save()
response = self.client.post(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.getEvents',
args=(self.practice.id, group2.id)), data=errData)
self.assertEqual(response.status_code, 403)
#success data and find 0 event
response = self.client.post(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.getEvents',
args=(self.practice.id, self.group.id)), data=successDate)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(data['redoSize'], 0)
self.assertEqual(data['undoSize'], 0)
self.assertEqual(data['datas'], '[]')
#success data and find 1 event
event = EventEntry(creator=self.user,
oncallPerson=self.user,
callGroup=self.group,
startDate=datetime.datetime(2012, 12, 1),
endDate=datetime.datetime(2012, 12, 30),
title='test event',
oncallLevel='0',
eventStatus=1,
checkString='abc'
)
event.save()
response = self.client.post(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.getEvents',
args=(self.practice.id, self.group.id)), data=successDate)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(data['redoSize'], 0)
self.assertEqual(data['undoSize'], 0)
d = json.loads(data['datas'])
self.assertEqual(len(d), 1)
self.assertEqual(d[0]['pk'], event.pk)
示例13: setUp
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def setUp(self):
clean_db_datas()
org_setting = OrganizationSetting()
org_setting.save()
org_type = OrganizationType(name="Test Org Type", organization_setting=org_setting, is_public=True)
org_type.save()
self.org = create_organization()
for i in range(10):
user_name = "".join(["Staff1_", str(i)])
first_name = "".join(["Test1_", str(i)])
user = create_user(user_name, first_name, 'S', 'demo')
self.staff = OfficeStaff()
self.staff.user = user
self.staff.office_lat = 0.0
self.staff.office_longit = 0.0
self.staff.save()
self.org_staff.append(self.staff)
# IntegrityError: column username is not unique
# provider_name = "".join(["Pravider1_", str(i)])
# pro = create_user(provider_name, 'Provider', 'P', 'demo', uklass=Provider)
# self.org_providers.append(pro)
self.user = create_user(get_random_username(), 'staff', 'S', 'demo')
staff = OfficeStaff()
staff.user = self.user
staff.office_lat = 0.0
staff.office_longit = 0.0
staff.save()
self.staff = staff
self.provider = create_user("Pravider2", 'Provider', 'P', 'demo', uklass=Provider)
self.provider.save()
示例14: test_community_providers
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def test_community_providers(self):
request = generateHttpRequest()
#find 0 provider
result = community_providers(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['data']['users']), 0)
#find 1 provider
phy = Physician(user=request.provider)
phy.save()
result = community_providers(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['data']['users']), 1)
organization_type = create_org_type()
practice = ct_practice('name', organization_type)
assn = SmartPhoneAssn.all_objects.get(device_id=request.REQUEST['DCOM_DEVICE_ID'])
assn.user_type = 100
assn.save(request)
staff = OfficeStaff(user=request.user, current_practice=practice)
staff.save()
result = community_providers(request)
self.assertEqual(result.status_code, 200)
msg = json.loads(result.content)
self.assertEqual(len(msg['data']['users']), 1)
示例15: test_saveViewInfo
# 需要导入模块: from MHLogin.MHLUsers.models import OfficeStaff [as 别名]
# 或者: from MHLogin.MHLUsers.models.OfficeStaff import save [as 别名]
def test_saveViewInfo(self):
staff = OfficeStaff(user=self.user)
staff.save()
staff.practices.add(self.practice)
staff.current_practice = self.practice
staff.save()
manager = Office_Manager(user=staff, practice=self.practice, manager_role=1)
manager.save()
#get method
response = self.client.get(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.saveViewInfo',
args=(self.practice.id, self.call_group.id)))
self.assertEqual(response.status_code, 200)
msg = json.loads(response.content)
self.assertEqual(msg['view'], '')
#403
call_group2 = CallGroup(description='test2', team='team')
call_group2.save()
response = self.client.post(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.saveViewInfo',
args=(self.practice.id, call_group2.id)))
self.assertEqual(response.status_code, 403)
#post method without session
view = {'view': '{"name": "month", "start": "2012-12-01 00:00:00", "end": "2013-01-01 00:00:00"}'}
response = self.client.post(reverse('MHLogin.MHLCallGroups.Scheduler.views_multicallgroup.saveViewInfo',
args=(self.practice.id, self.call_group.id)), data=view)
self.assertEqual(response.status_code, 200)
msg = json.loads(response.content)
self.assertEqual(msg['view'], view['view'])