def get_busy_dict_11_test(): """ Tests sequential one day events during the interval. """ begin_date = arrow.get().replace( tzinfo=tz.tzlocal(), hour=9, minute=0, second=0, microsecond=0, day=16, month=11, year=2015) end_date = arrow.get().replace( tzinfo=tz.tzlocal(), hour=17, minute=0, second=0, microsecond=0, day=20, month=11, year=2015) events = [{'start': {'dateTime': '2015-11-16T09:00:00-08:00'}, 'end': {'dateTime': '2015-11-16T10:00:00-08:00'}}, {'start': {'dateTime': '2015-11-16T10:00:00-08:00'}, 'end': {'dateTime': '2015-11-16T11:00:00-08:00'}}] busy = {'2015-11-16T09:00:00-08:00': {'start': {'dateTime': '2015-11-16T09:00:00-08:00'}, 'end': {'dateTime': '2015-11-16T10:00:00-08:00'}}, '2015-11-16T10:00:00-08:00': {'start': {'dateTime': '2015-11-17T10:00:00-08:00'}, 'end': {'dateTime': '2015-11-17T11:00:00-08:00'}}} busy_test = get_busy_dict(events, begin_date, end_date) for event in busy_test: assert event in busy
def get_busy_dict_4_test(): """ Test all day, 1 day events that start during and end during the interval. """ begin_date = arrow.get().replace( tzinfo=tz.tzlocal(), hour=9, minute=0, second=0, microsecond=0, day=16, month=11, year=2015) end_date = arrow.get().replace( tzinfo=tz.tzlocal(), hour=17, minute=0, second=0, microsecond=0, day=20, month=11, year=2015) events = [{'start': {'date': '2015-11-19'}, 'end': {'date': '2015-11-20'}}] busy = {'2015-11-19T09:00:00-08:00': {'start': {'dateTime': '2015-11-19T09:00:00-08:00'}, 'end': {'dateTime': '2015-11-20T17:00:00-08:00'}}} busy_test = get_busy_dict(events, begin_date, end_date) for event in busy_test: assert event in busy