def test_create_appointment(): """ Test creating an appointment with a patient and a provider """ # Arrange patient = Patient(first_name="Aly", last_name="Sivji") provider = Provider(first_name="Doctor", last_name="Acula") now = datetime.now() a = Appointment(start=now, end=now, department='foo', patient=patient, provider=provider) # Act db.session.add(a) db.session.commit() # Assert assert len(Appointment.query.all()) == 1 queried_appointment = Appointment.query.one() assert queried_appointment.department == 'foo' assert queried_appointment.patient_id == patient.id assert queried_appointment.provider_id == provider.id db.session.delete(a) db.session.delete(patient) db.session.delete(provider) db.session.commit()
def setUp(self): ''' Set up method that will run before every Test ''' self.new_provider = Provider(1234, 'Python Must Be Crazy', 'A thrilling new Python Series', '/khsjha27hbs', 8.5, 129993)
def create_provider(provider_name): provider = Provider(name=provider_name) check_provider = provider.query.filter_by(name=provider_name).first() if check_provider is not None: return None else: db.session.add(provider) db.session.commit() return provider
def setUp(self) -> None: self.redis = redis self.test_provider1 = Provider( 'http://www.mocky.io/v2/5d19ec932f00004e00fd7326', 'code', 'rate') self.test_provider1.rate_data = {'usd': 6, 'eur': 5, 'gbp': 1} self.test_provider2 = Provider( 'http://www.mocky.io/v2/5d19ec932f00004e00fd7326', 'code', 'rate') self.test_provider2.rate_data = {'usd': 2, 'eur': 1, 'gbp': 2} self.daily_test_data = [{ 'usd': 1, 'eur': 2, 'gbp': 3 }, { 'usd': 2, 'eur': 2, 'gbp': 7 }, { 'usd': 3, 'eur': 2, 'gbp': 5 }]
def lowest_rate(currency): currency = currency.lower() if currency not in AVAILABLE_CURRENCY_UNITS: return 'Lutfen gecerli bir para birimi giriniz' rate = is_cache_available_for_ten_mins() if rate: rate = parse_rate(rate) return json.dumps(rate['rates'][currency]) providers_env = json.loads(os.getenv('providers')) provider_list = [] for provider in providers_env: provider_list.append(Provider(provider['url'], provider['code_key'], provider['rate_key'])) rate = compare_providers(provider_list) return json.dumps(rate[currency])
def create_providers(): """ creates 1000 sample provides :return: None """ fake = Faker() for i in range(1000): provider_obj = Provider() provider_obj.name = fake.company() provider_obj.phone_number = fake.phone_number() provider_obj.email = "email" + str(random.randint(0, 9999)) + "@email.com" provider_obj.currency = config.CURRENCY[random.randint(0, len(config.CURRENCY) - 1)][0] provider_obj.language = config.LANGUAGES[random.randint(0, len(config.LANGUAGES) - 1)][0] provider_obj.created_by = User.objects.get(id=1) provider_obj.modified_by = User.objects.get(id=1) provider_obj.save()
def test_create_invalid_appointment_missing_patient(): """ Test creating an appointment with a provider and no patient """ # Arrange provider = Provider(first_name="Doctor", last_name="Acula") now = datetime.now() a = Appointment(start=now, end=now, department='foo', provider=provider) # Act db.session.add(a) # Assert with pytest.raises(IntegrityError): db.session.commit() db.session.rollback() assert len(Appointment.query.all()) == 0
def test_create_provider(): """ Test creating a provider """ # Arrange p = Provider(first_name="Doctor", last_name="Acula") # Act db.session.add(p) db.session.commit() # Assert assert len(Provider.query.all()) == 1 queried_provider = Provider.query.one() assert queried_provider.first_name == 'Doctor' assert queried_provider.last_name == 'Acula' db.session.delete(p) db.session.commit()
def add_provider(self, name): new_provider = Provider(name=name) db.session.add(new_provider) db.session.commit()
first_name="Alissa", last_name="Johnson") my_schedule_access = Security_Point(name="provider schedule access") orders_access = Security_Point(name="order creation") department_schedule_access = Security_Point( name="department schedule access") patient_search = Security_Point(name="patient search") chart_access = Security_Point(name="chart access") patient_checkin_access = Security_Point(name="patient checkin") patient_registration_access = Security_Point(name="patient registration") patient_user_access = Security_Point(name="patient user access") user_editor_access = Security_Point(name="user editor access") record_editor_access = Security_Point(name="record editor access") demo_provider = Provider(specialty="Family Medicine") demo_patient = Patient( firstName="Clare", lastName="Donohue-Meyer", dob=datetime.datetime(1993, 6, 22), sex="female", address_line_one="221B Baker St.", address_city="Austin", address_state="TX", address_zip="78731", bmi="22.74", beats_per_minute="75", weight="112", height="5'4''", ethnicity="White",
def create_provider(provider: ProviderDTO) -> ProviderDTO: provider = Provider(**provider.to_dict()) provider.save() provider.session.commit() return to_model(provider, ProviderDTO)
async def retrieve_single_provider(id: str): provider = mongo.get_db().providers.find_one({"_id": PyObjectId(id)}) return {'provider': Provider(**provider)}
async def retrieve_all_providers(): providers = [] for provider in mongo.get_db().providers.find(): providers.append(Provider(**provider)) return {'providers': providers}