Example #1
0
    def setUp(self):
        clean_db_datas()
        self.user = create_user(get_random_username(), 'yang', 'peng', 'demo')
        self.organization = create_organization()
        self.parent_organization = create_parent_organization()
        self.organization.save_parent_org(parent_org=self.parent_organization)
        staff = OfficeStaff()
        staff.user = self.user
        staff.office_lat = 0.0
        staff.office_longit = 0.0
        staff.current_practice = self.organization
        staff.save()
        staff.practices.add(self.organization)

        mgr = Office_Manager(user=staff,
                             practice=self.organization,
                             manager_role=2)
        mgr.save()

        self.provider = create_user(get_random_username(),
                                    "doc",
                                    "holiday",
                                    "demo",
                                    uklass=Provider)
        self.provider.current_practice = self.parent_organization
        self.provider.save()
        self.provider.practices.add(self.parent_organization)
Example #2
0
	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()
Example #3
0
	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()

		user1 = create_user(get_random_username(), 'Test1', 'S', 'demo')
		staff1 = OfficeStaff()
		staff1.user = user1
		staff1.office_lat = 0.0
		staff1.office_longit = 0.0
		staff1.current_practice = self.org
		staff1.save()
		staff1.practices.add(self.org)
		self.manager = Office_Manager(user=staff1, practice=self.org, manager_role=1)

		user = create_user(get_random_username(), 'Test1', 'S', 'demo')
		staff = OfficeStaff()
		staff.user = 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()
Example #4
0
    def setUpClass(cls):
        clean_db_datas()
        user = create_user(
            'practicemgr1',
            'lin',
            'xing',
            'demo',
            '',
            '',
            '',
            '',
        )
        cls.user = user
        call_group = CallGroup(description='test', team='team')
        call_group.save()
        cls.group = call_group

        practice = PracticeLocation(
            practice_name='Test Org',
            practice_longit='0.1',
            practice_lat='0.0',
        )
        practice.save()
        cls.practice = practice
        provider = Provider()
        provider.user = cls.user
        provider.office_lat = 0.0
        provider.office_longit = 0.0
        provider.current_practice = practice
        provider.save()
        provider.practices.add(practice)
        cls.provider = provider

        practice.call_groups.add(call_group)
        cls.practice = practice
Example #5
0
    def setUpClass(cls):
        clean_db_datas()
        cls.user = create_user(
            'practicemgr1',
            'lin',
            'xing',
            'demo',
            '',
            '',
            '',
            '',
        )

        call_group = CallGroup(description='test', team='team')
        call_group.save()
        cls.call_group = call_group

        practice = PracticeLocation(
            practice_name='test',
            practice_longit='0.1',
            practice_lat='0.0',
        )
        practice.save()
        practice.call_groups.add(call_group)
        cls.practice = practice
Example #6
0
	def setUpClass(cls):
		clean_db_datas()
		cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')
		cls.user1 = create_user('practicemgr11', 'y', 'p', 'demo')

		cls.broker = create_user("broker1", "bro", "1", "demo", 
							"123 Main St.", "Phoenix", "AZ", uklass=Broker)

		practice = PracticeLocation(practice_name='test',
								practice_longit='0.1',
								practice_lat='0.0',)
		practice.save()
		practice1 = PracticeLocation(practice_name='test1',
								practice_longit='0.1',
								practice_lat='0.0',)
		practice1.save()

		OrganizationRelationship.objects.create(organization=practice,\
			parent=practice1, create_time=int(time.time()), billing_flag=True)

		cls.practice = practice
		staff = OfficeStaff()
		staff.user = cls.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = practice
		staff.save()
		staff.practices.add(practice)

		cls.provider = Provider(user=cls.user1, office_lat=0.0, office_longit=0.0, current_practice = practice)
		cls.provider.mdcom_phone = '5948949899' 
		cls.provider.save()
#		
		mgr = Office_Manager(user=staff, practice=practice, manager_role=2)
		mgr.save()
Example #7
0
	def tearDown(self):
		clean_db_datas()
		settings.CALL_ENABLE = self.temp_CALL_ENABLE
		settings.SEND_MAXIMUM_PER_DAY = self.temp_SEND_MAXIMUM_PER_DAY
		settings.SEND_CODE_WAITING_TIME = self.temp_SEND_CODE_WAITING_TIME
		settings.FAIL_VALIDATE_MAXIMUM_PER_HOUR = self.temp_FAIL_VALIDATE_MAXIMUM_PER_HOUR
		settings.VALIDATE_LOCK_TIME = self.temp_VALIDATE_LOCK_TIMEE
Example #8
0
    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)
        self.org_type.save()

        self.organization = create_organization()

        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()
Example #9
0
	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()
Example #10
0
	def setUp(self):
		clean_db_datas()
		org_setting = OrganizationSetting()
		org_setting.save()
		self.org_type = OrganizationType(name="Test Org Type1", 
			organization_setting=org_setting, is_public=True)
		self.org_type.save()
Example #11
0
 def tearDown(self):
     clean_db_datas()
     settings.CALL_ENABLE = self.temp_CALL_ENABLE
     settings.SEND_MAXIMUM_PER_DAY = self.temp_SEND_MAXIMUM_PER_DAY
     settings.SEND_CODE_WAITING_TIME = self.temp_SEND_CODE_WAITING_TIME
     settings.FAIL_VALIDATE_MAXIMUM_PER_HOUR = self.temp_FAIL_VALIDATE_MAXIMUM_PER_HOUR
     settings.VALIDATE_LOCK_TIME = self.temp_VALIDATE_LOCK_TIMEE
Example #12
0
	def setUpClass(cls):
		clean_db_datas()
		cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')

		practice = PracticeLocation(practice_name='test',
								practice_longit='0.1',
								practice_lat='0.0',)
		practice.save()
		practice1 = PracticeLocation(practice_name='test1',
								practice_longit='0.1',
								practice_lat='0.0',)
		practice1.save()
		
		OrganizationRelationship.objects.create(organization=practice,\
				parent=practice1,create_time=int(time.time()),billing_flag=True)
		cls.practice = practice
		cls.practice1 = practice1
		staff = OfficeStaff()
		staff.user = cls.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = practice
		staff.save()
		staff.practices.add(practice)
		
		mgr = Office_Manager(user=staff, practice=practice, manager_role=2)
		mgr.save()
Example #13
0
	def setUp(self):
		clean_db_datas()
		self.request = generateHttpRequest()
		self.assn = SmartPhoneAssn.all_objects.get(device_id=self.request.REQUEST['DCOM_DEVICE_ID'])
		self.assn.user_type = 101
		self.assn.push_token = 'test smartPhoneAssn'
		self.assn.save(self.request)
Example #14
0
	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 = PracticeLocation(
			practice_name="Test1",
			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.org.organization_type = org_type
		self.org.save()

		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', uklass=OfficeStaff)
			self.org_staff.append(user)

			# 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.staff = create_user("Staff2", 'Test2', 'S', 'demo', uklass=OfficeStaff)
		self.staff.save()
		self.provider = create_user("Pravider2", 'Provider', 'P', 'demo', uklass=Provider)
		self.provider.save()
Example #15
0
 def setUp(self):
     clean_db_datas()
     org_setting = OrganizationSetting()
     org_setting.save()
     self.org_type = OrganizationType(name="Test Org Type1",
                                      organization_setting=org_setting,
                                      is_public=True)
     self.org_type.save()
Example #16
0
    def setUpClass(cls):
        clean_db_datas()

        organization_type = create_org_type()
        practice = ct_practice('name', organization_type)
        cls.practice = practice

        user = create_user('practicemgr1', 'lin', 'xing', 'demo')
        cls.user = user
Example #17
0
	def setUpClass(cls):
		clean_db_datas()
		cls.call_group = CallGroup.objects.create(description='test', team='team')
		cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')
		cls.user1 = create_user('practicemgr2', 'yang', 'peng', 'demo')
		cls.user2 = create_user('practicemgr234', 'yang1', 'peng1', 'demo')

		practice = PracticeLocation(practice_name='test',
								practice_longit='0.1',
								practice_lat='0.0',
								call_group = cls.call_group,)
		practice.save()
		practice1 = PracticeLocation(practice_name='test1',
								practice_longit='0.1',
								practice_lat='0.0',
								call_group = cls.call_group,)
		practice1.save()
		
		OrganizationRelationship.objects.create(organization=practice,\
				parent=practice1,create_time=int(time.time()),billing_flag=True)
		cls.practice = practice
		cls.practice1 = practice1
		
		provider = Provider(user=cls.user1, office_lat=0.0, office_longit=0.0, current_practice = practice)
		provider.save()
		provider.practices.add(practice)
		provider.practices.add(practice1)
		cls.provider = provider
		
		cls.provider2 = Provider(username="******", first_name="doc", 
								last_name="holiday", office_lat=0.0, office_longit=0.0)
		cls.provider2.set_password("holiday")
		cls.provider2.save()
		VMBox_Config(owner=cls.provider2).save()
		
		staff = OfficeStaff()
		staff.user = cls.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = practice
		staff.save()
		staff.practices.add(practice)
		
		cls.event = EventEntry(creator=cls.user,
						oncallPerson=cls.user1,
						callGroup=cls.call_group,
						startDate=datetime.datetime(2012, 12, 1),
						endDate=datetime.datetime.now()+datetime.timedelta(days = 2),
						title='test event',
						oncallLevel='0',
						eventStatus=1,
						checkString='abc'
						)
		cls.event.save()
		mgr = Office_Manager(user=staff, practice=practice, manager_role=2)
		mgr.save()
		generate_keys_for_users(output=DevNull())
Example #18
0
	def setUpClass(cls):
		clean_db_datas()

		organization_type = create_org_type()
		practice = ct_practice('name', organization_type)
		cls.practice = practice

		user = create_user('practicemgr1', 'lin', 'xing', 'demo')
		cls.user = user
Example #19
0
    def setUpClass(cls):
        clean_db_datas()
        cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')

        practice = PracticeLocation(
            practice_name='test',
            practice_longit='0.1',
            practice_lat='0.0',
        )
        practice.save()
        cls.practice = practice
Example #20
0
	def setUp(self):
		clean_db_datas()

		self.parent_organization = create_parent_organization()
		self.organization = create_organization()
		self.organization.save_parent_org(parent_org=self.parent_organization)

		self.org_members = []
		self.org_members = create_multiple_organizations(10)

		self.organization_not_member = create_organization_not_member()
Example #21
0
    def setUp(self):
        clean_db_datas()

        self.parent_organization = create_parent_organization()
        self.organization = create_organization()
        self.organization.save_parent_org(parent_org=self.parent_organization)

        self.org_members = []
        self.org_members = create_multiple_organizations(10)

        self.organization_not_member = create_organization_not_member()
Example #22
0
	def setUp(self):
		clean_db_datas()
		self.organization = create_organization(auto_type=False)

		self.org_setting = OrganizationSetting()
		self.org_setting.save()

		self.org_type_setting = OrganizationSetting()
		self.org_type_setting.save()
		self.org_type = OrganizationType(name="Test Org Type", organization_setting=self.org_type_setting)
		self.org_type.save()
Example #23
0
    def setUp(self):
        clean_db_datas()
        self.organization = create_organization(auto_type=False)

        self.org_setting = OrganizationSetting()
        self.org_setting.save()

        self.org_type_setting = OrganizationSetting()
        self.org_type_setting.save()
        self.org_type = OrganizationType(
            name="Test Org Type", organization_setting=self.org_type_setting)
        self.org_type.save()
Example #24
0
	def setUpClass(cls):
		clean_db_datas()

		cls.owner = create_user('TestProvider', "Li", 'Wen', 'demo')
		staffs = []
		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', uklass=OfficeStaff)
			staffs.append(user)
		cls.staffs = staffs
		cls.organizations = create_multiple_organizations()
Example #25
0
	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
Example #26
0
    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
Example #27
0
    def setUp(self):
        clean_db_datas()
        self.user = create_user(get_random_username(), "yang", "peng", "demo")
        self.user.mobile_phone = 9563322588
        self.user.mobile_confirmed = True
        self.user.email_confirmed = True
        self.user.save()

        self.provider = Provider(user=self.user,
                                 office_lat=0.0,
                                 office_longit=0.0,
                                 pager='8001234567')
        self.provider.save()
	def setUpClass(cls):
		clean_db_datas()
		cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo', '', '', '', '',)

		group = CallGroup(description='test', team='team')
		group.save()
		cls.group = group

		practice = PracticeLocation(practice_name='test',
								practice_longit='0.1',
								practice_lat='0.0',)
		practice.save()
		practice.call_groups.add(group)
		cls.practice = practice
Example #29
0
	def setUpClass(cls):
		clean_db_datas()
		cls.user = create_user(get_random_username(), "tian", "thj", "demo", 
			"555 Bryant St.", "Palo Alto", "CA", "", uklass=Provider)
		cls.user.mdcom_phone = '9001234123'
		cls.user.save()

		cls.client = Client()

		cls.extra = {
			'HTTP_MDCOM_API_KEY': 'TODO_OAUTH',  # TODO: update with OAuth, #2049
			'HTTP_MDCOM_USER_UUID': cls.user.uuid,
			'REMOTE_ADDR': '10.200.0.222',
		}
Example #30
0
    def setUp(self):
        clean_db_datas()
        self.temp_CALL_ENABLE = settings.CALL_ENABLE
        self.temp_SEND_MAXIMUM_PER_DAY = settings.SEND_MAXIMUM_PER_DAY
        self.temp_SEND_CODE_WAITING_TIME = settings.SEND_CODE_WAITING_TIME
        self.temp_FAIL_VALIDATE_MAXIMUM_PER_HOUR = settings.FAIL_VALIDATE_MAXIMUM_PER_HOUR
        self.temp_VALIDATE_LOCK_TIMEE = settings.VALIDATE_LOCK_TIME

        settings.SEND_MAXIMUM_PER_DAY = 5
        settings.SEND_CODE_WAITING_TIME = 2
        settings.FAIL_VALIDATE_MAXIMUM_PER_HOUR = 3
        settings.VALIDATE_LOCK_TIME = 2

        self.provider = create_user(get_random_username(),
                                    "yang",
                                    "peng",
                                    "demo",
                                    uklass=Provider)
        self.provider.mobile_phone = '9563322588'
        self.provider.mobile_confirmed = True
        self.provider.email = '*****@*****.**'
        self.provider.email_confirmed = True
        self.provider.save()

        self.organization = create_organization()
        self.user = create_user(get_random_username(), "yang", "peng", "demo")
        staff = OfficeStaff()
        staff.user = self.user
        staff.pager = '9985622456'
        staff.office_lat = 0.0
        staff.office_longit = 0.0
        staff.current_practice = self.organization
        staff.save()
        self.staff = staff

        self.user_bro = create_user(get_random_username(), "yang", "peng",
                                    "demo")
        self.broker = Broker()
        self.broker.pager = '9985622456'
        self.broker.user = self.user_bro
        self.broker.office_lat = 0.0
        self.broker.office_longit = 0.0
        self.broker.save()

        self.user = create_user(get_random_username(), "yang", "peng", "demo")
        self.user.mobile_phone = '9563322488'
        self.user.mobile_confirmed = True
        self.user.email_confirmed = True
        self.user.save()
Example #31
0
 def tearDownClass(cls):
     MessageBodyUserStatus.objects.all().delete()
     MessageBody.objects.all().delete()
     MessageAttachmentDicom.objects.all().delete()
     MessageAttachment.objects.all().delete()
     MessageCC.objects.all().delete()
     MessageRecipient.objects.all().delete()
     MessageRefer.objects.all().delete()
     MessageActionHistory.objects.all().delete()
     Message.objects.all().delete()
     VMBox_Config.objects.all().delete()
     UserPrivateKey.objects.all().delete()
     OwnerPublicKey.objects.all().delete()
     Provider.objects.all().delete()
     clean_db_datas()
Example #32
0
	def tearDownClass(cls):
		MessageBodyUserStatus.objects.all().delete()
		MessageBody.objects.all().delete()
		MessageAttachmentDicom.objects.all().delete()
		MessageAttachment.objects.all().delete()
		MessageCC.objects.all().delete()
		MessageRecipient.objects.all().delete()
		MessageRefer.objects.all().delete()
		MessageActionHistory.objects.all().delete()
		Message.objects.all().delete()
		VMBox_Config.objects.all().delete()
		UserPrivateKey.objects.all().delete()
		OwnerPublicKey.objects.all().delete()
		Provider.objects.all().delete()
		clean_db_datas()
Example #33
0
    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 = PracticeLocation(
            practice_name="Test1",
            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.org.organization_type = org_type
        self.org.save()

        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',
                               uklass=OfficeStaff)
            self.org_staff.append(user)

            # 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.staff = create_user("Staff2",
                                 'Test2',
                                 'S',
                                 'demo',
                                 uklass=OfficeStaff)
        self.staff.save()
        self.provider = create_user("Pravider2",
                                    'Provider',
                                    'P',
                                    'demo',
                                    uklass=Provider)
        self.provider.save()
Example #34
0
    def setUpClass(cls):
        clean_db_datas()
        cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')
        cls.user1 = create_user('practicemgr11', 'y', 'p', 'demo')

        cls.broker = create_user("broker1",
                                 "bro",
                                 "1",
                                 "demo",
                                 "123 Main St.",
                                 "Phoenix",
                                 "AZ",
                                 uklass=Broker)

        practice = PracticeLocation(
            practice_name='test',
            practice_longit='0.1',
            practice_lat='0.0',
        )
        practice.save()
        practice1 = PracticeLocation(
            practice_name='test1',
            practice_longit='0.1',
            practice_lat='0.0',
        )
        practice1.save()

        OrganizationRelationship.objects.create(organization=practice,\
         parent=practice1, create_time=int(time.time()), billing_flag=True)

        cls.practice = practice
        staff = OfficeStaff()
        staff.user = cls.user
        staff.office_lat = 0.0
        staff.office_longit = 0.0
        staff.current_practice = practice
        staff.save()
        staff.practices.add(practice)

        cls.provider = Provider(user=cls.user1,
                                office_lat=0.0,
                                office_longit=0.0,
                                current_practice=practice)
        cls.provider.mdcom_phone = '5948949899'
        cls.provider.save()
        #
        mgr = Office_Manager(user=staff, practice=practice, manager_role=2)
        mgr.save()
Example #35
0
    def setUp(self):
        clean_db_datas()

        self.org_setting = OrganizationSetting(
            can_have_physician=True,
            can_have_nppa=True,
            can_have_medical_student=True,
            can_have_staff=True,
            can_have_manager=True,
            can_have_nurse=True,
            can_have_tech_admin=True,
        )
        self.org_setting.save()

        self.organization = create_organization()
        self.organization.organization_setting = self.org_setting
Example #36
0
    def setUpClass(cls):
        clean_db_datas()

        cls.owner = create_user('TestProvider', "Li", 'Wen', 'demo')
        staffs = []
        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',
                               uklass=OfficeStaff)
            staffs.append(user)
        cls.staffs = staffs
        cls.organizations = create_multiple_organizations()
Example #37
0
	def setUp(self):
		clean_db_datas()

		self.org_setting = OrganizationSetting(
				can_have_physician = True,
				can_have_nppa = True,
				can_have_medical_student = True,
				can_have_staff = True,
				can_have_manager = True,
				can_have_nurse = True,
				can_have_tech_admin = True,
			)
		self.org_setting.save()

		self.organization = create_organization()
		self.organization.organization_setting = self.org_setting
Example #38
0
	def setUp(self):
		clean_db_datas()
		self.user = create_user(get_random_username(),'yang','peng','demo')
		org_setting = OrganizationSetting(display_in_contact_list_tab=True)
		org_setting.save()
		self.org_type = OrganizationType(name="Test Org Type", organization_setting=org_setting, is_public=True)
		self.org_type.save()
		self.org = create_organization()
		staff = OfficeStaff()
		staff.user = self.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.save()
		self.staff = staff

		self.org_members = []
		self.org_members = create_multiple_organizations(10)
Example #39
0
	def setUpClass(cls):
		clean_db_datas()
		cls.user = create_user(get_random_username(), 'lin', 'xing', 'demo')
		cls.user1 = create_user(get_random_username(), 'y', 'p', 'demo')
		cls.user2 = create_user(get_random_username(), 'y', 'p', 'demo')
		cls.to_user = create_user(get_random_username(), "tian", "thj", "demo", "555 Bryant St.",
								"Palo Alto", "CA", "")

		practice = PracticeLocation(practice_name='test',
								practice_longit='0.1',
								practice_lat='0.0',)
		practice.save()
		practice1 = PracticeLocation(practice_name='test1',
								practice_longit='0.1',
								practice_lat='0.0',)
		practice1.save()
		
		OrganizationRelationship.objects.create(organization=practice,\
				parent=practice1,create_time=int(time.time()),billing_flag=True)
		cls.practice = practice
		cls.practice1 = practice1
		
		assoc = Pending_Association()
		assoc.from_user = cls.user1
		assoc.to_user = cls.to_user
		assoc.practice_location = practice
		assoc.created_time = datetime.datetime(2013, 5, 14, 12, 30)
		assoc.resent_time = datetime.datetime(2013, 5, 14, 13, 30)
		assoc.save()
		cls.assoc = assoc
		
		provider = Provider(user=cls.to_user, office_lat=0.0, office_longit=0.0, current_practice = practice)
		provider.save()
		cls.provider = provider
		
		staff = OfficeStaff()
		staff.user = cls.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = practice
		staff.save()
		staff.practices.add(practice)
		
		mgr = Office_Manager(user=staff, practice=practice, manager_role=2)
		mgr.save()
Example #40
0
    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()
Example #41
0
	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)
		self.org_type.save()

		self.organization = create_organization()

		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()
Example #42
0
	def setUp(self):
		clean_db_datas()
		self.request = generateHttpRequest()
		self.assn = SmartPhoneAssn.all_objects.get(device_id=self.request.REQUEST['DCOM_DEVICE_ID'])
		self.assn.user_type = 101
		self.assn.push_token = 'test smartPhoneAssn'
		self.assn.save(self.request)
		
		env = Client()._base_environ()
		request = HttpRequest()
		request.META['REMOTE_ADDR'] = env['REMOTE_ADDR']
		self.assn1_request = request
		self.assn1 = SmartPhoneAssn()
		self.assn1.user = self.request.user
		self.assn1.user_type = 2
		self.assn1.platform = 'iPhone'
		self.assn1.push_token = 'test smartPhoneAssn1'
		self.assn1.save(request)
Example #43
0
    def setUpClass(cls):
        clean_db_datas()
        cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')
        org_setting = OrganizationSetting()
        org_setting.save()
        org_type = OrganizationType(name="Test Org Type",
                                    organization_setting=org_setting,
                                    is_public=True)
        org_type.save()
        cls.org_type = org_type
        sub_types = create_multiple_organization_types(org_type)
        cls.sub_types = sub_types

        practice = PracticeLocation(
            practice_name='test',
            practice_longit='0.1',
            practice_lat='0.0',
            organization_type=org_type,
        )
        practice.save()
        practice1 = PracticeLocation(
            practice_name='test1',
            practice_longit='0.1',
            practice_lat='0.0',
            organization_type=org_type,
        )
        practice1.save()
        OrganizationRelationship.objects.create(organization=practice,
                                                parent=practice1,
                                                create_time=int(time.time()),
                                                billing_flag=True)
        cls.practice = practice
        cls.practice1 = practice1

        staff = OfficeStaff()
        staff.user = cls.user
        staff.office_lat = 0.0
        staff.office_longit = 0.0
        staff.current_practice = practice
        staff.save()
        staff.practices.add(practice)

        mgr = Office_Manager(user=staff, practice=practice, manager_role=2)
        mgr.save()
Example #44
0
	def setUp(self):
		clean_db_datas()
		self.temp_CALL_ENABLE = settings.CALL_ENABLE
		self.temp_SEND_MAXIMUM_PER_DAY = settings.SEND_MAXIMUM_PER_DAY
		self.temp_SEND_CODE_WAITING_TIME = settings.SEND_CODE_WAITING_TIME
		self.temp_FAIL_VALIDATE_MAXIMUM_PER_HOUR = settings.FAIL_VALIDATE_MAXIMUM_PER_HOUR
		self.temp_VALIDATE_LOCK_TIMEE = settings.VALIDATE_LOCK_TIME

		settings.SEND_MAXIMUM_PER_DAY = 5
		settings.SEND_CODE_WAITING_TIME = 2
		settings.FAIL_VALIDATE_MAXIMUM_PER_HOUR = 3
		settings.VALIDATE_LOCK_TIME = 2

		self.provider = create_user(get_random_username(), "yang", "peng", "demo",uklass=Provider)
		self.provider.mobile_phone = '9563322588'
		self.provider.mobile_confirmed = True
		self.provider.email = '*****@*****.**'
		self.provider.email_confirmed =True
		self.provider.save()
		
		self.organization = create_organization()
		self.user = create_user(get_random_username(), "yang", "peng", "demo")
		staff = OfficeStaff()
		staff.user = self.user
		staff.pager = '9985622456'
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = self.organization
		staff.save()
		self.staff = staff
		
		self.user_bro = create_user(get_random_username(), "yang", "peng", "demo")
		self.broker = Broker()
		self.broker.pager = '9985622456'
		self.broker.user = self.user_bro
		self.broker.office_lat = 0.0
		self.broker.office_longit = 0.0
		self.broker.save()
		
		self.user = create_user(get_random_username(), "yang", "peng", "demo")
		self.user.mobile_phone = '9563322488'
		self.user.mobile_confirmed = True
		self.user.email_confirmed =True
		self.user.save()
Example #45
0
    def setUp(self):
        clean_db_datas()
        self.user = create_user(get_random_username(), 'yang', 'peng', 'demo')
        org_setting = OrganizationSetting(display_in_contact_list_tab=True)
        org_setting.save()
        self.org_type = OrganizationType(name="Test Org Type",
                                         organization_setting=org_setting,
                                         is_public=True)
        self.org_type.save()
        self.org = create_organization()
        staff = OfficeStaff()
        staff.user = self.user
        staff.office_lat = 0.0
        staff.office_longit = 0.0
        staff.save()
        self.staff = staff

        self.org_members = []
        self.org_members = create_multiple_organizations(10)
Example #46
0
	def setUpClass(cls):
		clean_db_datas()

		cls.owner = create_user('TestProvider', "Li", 'Wen', 'demo')
		staffs = []
		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', uklass=OfficeStaff)
			staffs.append(user)
		cls.staffs = staffs
		cls.organizations = create_multiple_organizations()

		for ele in cls.staffs:
			do_toggle_favorite(cls.owner, 1, ele.user.id)
			# repeat add same object, 
			# the function 'do_toggle_favorite' shouldn't raise error  
			do_toggle_favorite(cls.owner, 1, ele.user.id)
		for ele in cls.organizations:
			do_toggle_favorite(cls.owner, 2, ele.id)
Example #47
0
	def setUpClass(cls):
		clean_db_datas()
		cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')
		cls.admin = create_user("sduper", "super", "duper", "demo", 
							"Ocean Avenue", "Carmel", "CA", "93921", uklass=Administrator)
		cls.admin.save()
		org_setting = OrganizationSetting(can_have_manager=True,\
						can_have_nurse=True,can_have_dietician=True)
		org_setting.save()
		org_type = OrganizationType(name="Test Org Type", \
						organization_setting=org_setting, is_public=True)
		org_type.save()
		cls.org_type = org_type
		cls.org_setting = org_setting
		
		practice = PracticeLocation(practice_name='test',
								practice_longit='0.1',
								practice_lat='0.0',
								organization_setting =org_setting,
								organization_type = org_type)
		practice.save()
		practice1 = PracticeLocation(practice_name='test1',
								practice_longit='0.1',
								practice_lat='0.0',
								organization_setting =org_setting,
								organization_type = org_type)
		practice1.save()
		cls.practice = practice
		cls.practice1 = practice1
		
		staff = OfficeStaff()
		staff.user = cls.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = practice
		staff.save()
		staff.practices.add(practice)
		cls.staff = staff
		
		mgr = Office_Manager(user=staff, practice=practice, manager_role=2)
		mgr.save()
Example #48
0
	def setUpClass(cls):
		clean_db_datas()
		cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')
		cls.user1 = create_user('practicemgr2', 'yang', 'peng', 'demo')

		practice = PracticeLocation(practice_name='test',
								practice_longit='0.1',
								practice_lat='0.0',)
		practice.save()
		practice1 = PracticeLocation(practice_name='test1',
								practice_longit='0.1',
								practice_lat='0.0',)
		practice1.save()
		
		OrganizationRelationship.objects.create(organization=practice,\
				parent=practice1,create_time=int(time.time()),billing_flag=True)
		cls.practice = practice
		cls.practice1 = practice1
		staff = OfficeStaff()
		staff.user = cls.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = practice
		staff.save()
		staff.practices.add(practice)
		cls.staff = staff
		
		cls.content_type=ContentType.objects.get_for_model(cls.user1)
		try:
			perm = Permission.objects.get(codename='access_smartphone',\
					name='Can use smartphone app', \
					content_type=ContentType.objects.get_for_model(MHLUser))
			staff.user.user_permissions.remove(perm)
			staff.save()
		except:
			with cls.assertRaises(Permission.DoesNotExist):\
					Permission.objects.get(codename='access_smartphone',\
					name='Can use smartphone app', \
					content_type=ContentType.objects.get_for_model(MHLUser))
		mgr = Office_Manager(user=staff, practice=practice, manager_role=2)
		mgr.save()
Example #49
0
    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()
Example #50
0
	def setUp(self):
		clean_db_datas()
		self.user = create_user(get_random_username(),'yang','peng','demo')
		self.organization = create_organization()
		self.parent_organization = create_parent_organization()
		self.organization.save_parent_org(parent_org=self.parent_organization)
		staff = OfficeStaff()
		staff.user = self.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = self.organization
		staff.save()
		staff.practices.add(self.organization)

		mgr = Office_Manager(user=staff, practice=self.organization, manager_role=2)
		mgr.save()

		self.provider = create_user(get_random_username(), "doc", "holiday", "demo", uklass=Provider)
		self.provider.current_practice = self.parent_organization
		self.provider.save()
		self.provider.practices.add(self.parent_organization)
Example #51
0
	def setUp(self):
		clean_db_datas()
		org_setting = OrganizationSetting(can_have_physician=True)
		org_setting.save()
		self.org_setting = org_setting
		org_type = OrganizationType(name="Test Org Type", 
			organization_setting=org_setting, is_public=True)
		org_type.save()
		self.org_type = org_type

		practice = PracticeLocation(practice_name='test',
						practice_longit='0.1',
						practice_lat='0.0',
						organization_type=org_type,
						organization_setting=org_setting,)
		practice.save()
		self.practice = practice

		user = create_user('admin', 'Morris', 'Kelly', 'demo', uklass=Administrator)
		user.save()
		self.client.post('/login/', {'username': user.user.username, 'password': '******'})
Example #52
0
    def setUpClass(cls):
        clean_db_datas()
        cls.user = create_user(get_random_username(),
                               "tian",
                               "thj",
                               "demo",
                               "555 Bryant St.",
                               "Palo Alto",
                               "CA",
                               "",
                               uklass=Provider)
        cls.user.mdcom_phone = '9001234123'
        cls.user.save()

        cls.client = Client()

        cls.extra = {
            'HTTP_MDCOM_API_KEY':
            'TODO_OAUTH',  # TODO: update with OAuth, #2049
            'HTTP_MDCOM_USER_UUID': cls.user.uuid,
            'REMOTE_ADDR': '10.200.0.222',
        }
Example #53
0
	def setUpClass(cls):
		clean_db_datas()
		cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')

		org_setting = OrganizationSetting()
		org_setting.save()
		org_type = OrganizationType(name="Test Org Type", 
			organization_setting=org_setting, is_public=True)
		org_type.save()
		cls.org_type = org_type
		sub_types = create_multiple_organization_types(org_type)
		cls.sub_types = sub_types

		practice = PracticeLocation(practice_name='test',
								practice_longit='0.1',
								practice_lat='0.0',
								organization_type = org_type)
		practice.save()
		practice1 = PracticeLocation(practice_name='test1',
								practice_longit='0.1',
								practice_lat='0.0',
								organization_type = org_type)
		practice1.save()

		OrganizationRelationship.objects.create(organization=practice,\
				parent=practice1,create_time=int(time.time()),billing_flag=True)
		cls.practice = practice
		staff = OfficeStaff()
		staff.user = cls.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = practice
		staff.save()
		staff.practices.add(practice)

		mgr = Office_Manager(user=staff, practice=practice, manager_role=2)
		mgr.save()
Example #54
0
    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()

        user1 = create_user(get_random_username(), 'Test1', 'S', 'demo')
        staff1 = OfficeStaff()
        staff1.user = user1
        staff1.office_lat = 0.0
        staff1.office_longit = 0.0
        staff1.current_practice = self.org
        staff1.save()
        staff1.practices.add(self.org)
        self.manager = Office_Manager(user=staff1,
                                      practice=self.org,
                                      manager_role=1)

        user = create_user(get_random_username(), 'Test1', 'S', 'demo')
        staff = OfficeStaff()
        staff.user = 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()
Example #55
0
    def setUpClass(cls):
        clean_db_datas()

        cls.owner = create_user('TestProvider', "Li", 'Wen', 'demo')
        staffs = []
        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',
                               uklass=OfficeStaff)
            staffs.append(user)
        cls.staffs = staffs
        cls.organizations = create_multiple_organizations()

        for ele in cls.staffs:
            do_toggle_favorite(cls.owner, 1, ele.user.id)
            # repeat add same object,
            # the function 'do_toggle_favorite' shouldn't raise error
            do_toggle_favorite(cls.owner, 1, ele.user.id)
        for ele in cls.organizations:
            do_toggle_favorite(cls.owner, 2, ele.id)
Example #56
0
 def tearDownClass(cls):
     clean_db_datas()
Example #57
0
	def setUpClass(cls):
		from MHLogin.MHLOrganization.tests.utils import create_multiple_organization_types
		clean_db_datas()
		cls.user = create_user('practicemgr1', 'lin', 'xing', 'demo')
		org_setting = OrganizationSetting(can_have_staff=True, 
			can_have_nurse=True, can_have_dietician=True)
		org_setting.save()

		org_type = OrganizationType(name="Test Org Type - old type", 
				organization_setting=org_setting, is_public=True)
		org_type.save()
		cls.org_type = org_type

		parent_org_type = OrganizationType(name="Test Org Type - parent type", organization_setting=org_setting, is_public=True)
		parent_org_type.save()
		cls.parent_org_type = parent_org_type

		sub_types = create_multiple_organization_types(parent_org_type)
		cls.sub_types = sub_types

		old_parent_practice = PracticeLocation(practice_name='old org parent',
								practice_longit='0.1',
								practice_lat='0.0',
								organization_setting=org_setting,
								organization_type=parent_org_type,)
		old_parent_practice.save()
		OrganizationRelationship.objects.create(organization=old_parent_practice,
			parent=None, create_time=int(time.time()), billing_flag=True)
		cls.old_parent_practice = old_parent_practice

		practice = PracticeLocation(practice_name='test org',
								practice_longit='0.1',
								practice_lat='0.0',
								organization_setting=org_setting,
								organization_type=org_type,)
		practice.save()

		OrganizationRelationship.objects.create(organization=practice,\
			parent=old_parent_practice, create_time=int(time.time()), billing_flag=True)

		new_parent_practice = PracticeLocation(practice_name='new org parent',
								practice_longit='0.1',
								practice_lat='0.0',
								organization_setting=org_setting,
								organization_type=parent_org_type,)
		new_parent_practice.save()
		OrganizationRelationship.objects.create(organization=new_parent_practice,
			parent=None, create_time=int(time.time()), billing_flag=True)

		cls.new_parent_practice = new_parent_practice
		cls.practice = practice

		staff = OfficeStaff()
		staff.user = cls.user
		staff.office_lat = 0.0
		staff.office_longit = 0.0
		staff.current_practice = practice
		staff.save()
		staff.practices.add(practice)
		staff.practices.add(old_parent_practice)
		staff.practices.add(new_parent_practice)
		cls.staff = staff
		Office_Manager.objects.create(user=staff, practice=practice, manager_role=2)

		datadict = {
			'user_type':1,
			'org_id': practice.id,
			'username':get_random_username(),
			'first_name':'yang',
			'last_name':'peng',
			'mobile_phone':9001111111,
			'gender':'M',
			'email':'*****@*****.**',
			'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,
		}
		cls.datadict = datadict