def test_referral_facility_available_datetime_day(self): facility = Facility(name='leiden', days=[TU, WE], forward_only=True) referral_facility = ReferralFacility(facility=facility, routine_codes=['MASA-CC']) scheduled_appt_datetime = Arrow.fromdate(datetime(2001, 12, 4, 7, 30)).datetime dt = referral_facility.available_datetime( referral_code='MASA-CC', scheduled_appt_datetime=scheduled_appt_datetime) self.assertEqual(weekday(dt.weekday()), TU) scheduled_appt_datetime = Arrow.fromdate(datetime(2001, 12, 5, 7, 30)).datetime dt = referral_facility.available_datetime( referral_code='MASA-CC', scheduled_appt_datetime=scheduled_appt_datetime) self.assertEqual(weekday(dt.weekday()), WE) scheduled_appt_datetime = Arrow.fromdate(datetime(2001, 12, 6, 7, 30)).datetime dt = referral_facility.available_datetime( referral_code='MASA-CC', scheduled_appt_datetime=scheduled_appt_datetime) self.assertEqual(weekday(dt.weekday()), TU)
def test_referral_facility_urgent_available_datetime(self): """Asserts picks correct date. """ facility = Facility(name='leiden', days=[TU, WE], forward_only=True) referral_facility = ReferralFacility(facility=facility, routine_codes=['MASA-CC'], urgent_codes=['MASA-DF']) # pick a tuesday scheduled_appt_datetime = Arrow.fromdate(datetime(2001, 12, 4, 7, 30)).datetime # pick a wednesday report_datetime = Arrow.fromdate(datetime(2001, 12, 5, 7, 30)).datetime dt = referral_facility.available_datetime( referral_code='MASA-CC', scheduled_appt_datetime=scheduled_appt_datetime, report_datetime=report_datetime) self.assertEqual(dt, scheduled_appt_datetime) dt = referral_facility.available_datetime( referral_code='MASA-DF', scheduled_appt_datetime=scheduled_appt_datetime, report_datetime=report_datetime) self.assertEqual(dt, report_datetime)