def test_window_set_with_muted_window_is_not_available(): now_dt = arrow.get('2014-01-01T09:09:00.000-05:00') tw = TimeWindow(ical=ical_event_night, CompareDateTime=now_dt) l = LocationAvailability(LocationName='kitchen') l.add_window(tw) tw_night = TimeWindow(ical=ical_event, CompareDateTime=now_dt, IsMuted=True) l.add_window(tw_night) assert not l.is_available(dt=now_dt)
def test_db_window_set_with_muted_window_is_not_available(): now_dt = arrow.get('2014-01-01T09:09:00.000-05:00') tw = TimeWindow(ical=ical_event, CompareDateTime=now_dt) l = LocationAvailability(LocationName='kitchen') l.add_window(tw) tw = TimeWindow(ical=ical_event, CompareDateTime=now_dt, IsMuted=True) l.add_window(tw) lm = LocationManager() lm.update_window_set(l) l = lm.get_location('kitchen') assert not l.is_available(dt=now_dt)
def test_time_inside_window_is_available(): now_dt = arrow.get('2014-01-01T09:09:00.000-05:00') tw = TimeWindow(ical=ical_event, CompareDateTime=now_dt) l = LocationAvailability() l.add_window(tw) assert l.is_available(dt=now_dt)