Example #1
0
def get_meeting_times_8_test():
    """
    Tests multiple free times on different days.
    """
    free_times = [('2015-11-16T09:00:00-08:00', '2015-11-16T10:00:00-08:00'),
                  ('2015-11-16T13:00:00-08:00', '2015-11-16T15:00:00-08:00'),
                  ('2015-11-16T16:00:00-08:00', '2015-11-16T17:00:00-08:00'),
                  ('2015-11-17T10:00:00-08:00', '2015-11-17T11:00:00-08:00'),
                  ('2015-11-17T16:00:00-08:00', '2015-11-18T10:00:00-08:00'),
                  ('2015-11-18T11:00:00-08:00', '2015-11-18T14:00:00-08:00')]

    meeting_times = [{'start': {'dateTime': '2015-11-16T09:00:00-08:00'},
                      'end': {'dateTime': '2015-11-16T10:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-16T13:00:00-08:00'},
                      'end': {'dateTime': '2015-11-16T14:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-16T14:00:00-08:00'},
                      'end': {'dateTime': '2015-11-16T15:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-16T16:00:00-08:00'},
                      'end': {'dateTime': '2015-11-16T17:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T10:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T11:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T16:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T17:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T09:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T10:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T11:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T12:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T12:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T13:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T13:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T14:00:00-08:00'}}]

    assert meeting_times == get_meeting_times(free_times)
Example #2
0
def get_meeting_times_7_test():
    """
    Tests a multi-day free time ending on an hour before second day's end.
    """
    free_times = [('2015-11-17T16:00:00-08:00', '2015-11-18T10:00:00-08:00')]

    meeting_times = [{'start': {'dateTime': '2015-11-17T16:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T17:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T09:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T10:00:00-08:00'}}]

    assert meeting_times == get_meeting_times(free_times)
Example #3
0
def get_meeting_times_5_test():
    """
    Tests two days with one free time each starting and ending on hours.
    """
    free_times = [('2015-11-17T09:00:00-08:00', '2015-11-17T11:00:00-08:00'),
                  ('2015-11-18T09:00:00-08:00', '2015-11-18T11:00:00-08:00')]

    meeting_times = [{'start': {'dateTime': '2015-11-17T09:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T10:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T10:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T11:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T09:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T10:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T10:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T11:00:00-08:00'}}]

    assert meeting_times == get_meeting_times(free_times)
Example #4
0
def get_meeting_times_4_test():
    """
    Tests a single day with two free times starting and ending on hours.
    """
    free_times = [('2015-11-17T09:00:00-08:00', '2015-11-17T10:00:00-08:00'),
                  ('2015-11-17T11:00:00-08:00', '2015-11-17T15:00:00-08:00')]

    meeting_times = [{'start': {'dateTime': '2015-11-17T09:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T10:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T11:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T12:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T12:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T13:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T13:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T14:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T14:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T15:00:00-08:00'}}]

    assert meeting_times == get_meeting_times(free_times)
Example #5
0
def get_meeting_times_3_test():
    """
    Tests a single day with one free time starting on a minute and ending on a
    hour.
    """
    free_times = [('2015-11-17T09:30:00-08:00', '2015-11-17T15:00:00-08:00')]

    meeting_times = [{'start': {'dateTime': '2015-11-17T10:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T11:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T11:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T12:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T12:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T13:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T13:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T14:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T14:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T15:00:00-08:00'}}]

    assert meeting_times == get_meeting_times(free_times)
Example #6
0
def get_meeting_times_6_test():
    """
    Tests a multi-day free time starting and ending on an hour.
    """
    free_times = [('2015-11-17T09:00:00-08:00', '2015-11-18T17:00:00-08:00')]

    meeting_times = [{'start': {'dateTime': '2015-11-17T09:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T10:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T10:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T11:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T11:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T12:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T12:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T13:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T13:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T14:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T14:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T15:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T15:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T16:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T16:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T17:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T09:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T10:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T10:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T11:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T11:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T12:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T12:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T13:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T13:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T14:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T14:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T15:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T15:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T16:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-18T16:00:00-08:00'},
                      'end': {'dateTime': '2015-11-18T17:00:00-08:00'}}]

    assert meeting_times == get_meeting_times(free_times)
Example #7
0
def get_meeting_times_9_test():
    """
    Tests one day with free time all day.
    """
    free_times = [('2015-11-17T09:00:00-08:00', '2015-11-17T17:00:00-08:00')]

    meeting_times = [{'start': {'dateTime': '2015-11-17T09:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T10:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T10:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T11:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T11:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T12:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T12:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T13:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T13:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T14:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T14:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T15:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T15:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T16:00:00-08:00'}},
                     {'start': {'dateTime': '2015-11-17T16:00:00-08:00'},
                      'end': {'dateTime': '2015-11-17T17:00:00-08:00'}}]

    assert meeting_times == get_meeting_times(free_times)
Example #8
0
def init_meeting_times():
    """
    Initializes the meeting times list.
    """
    flask.session["meeting_times"] = get_meeting_times(flask.session["free_times"])