Example #1
0
 def __init__(self, id, start_time, notes, table_ids, json):
     self.id = id
     self.start_time = start_time
     self.notes = Note(notes)
     self.json = json
     self.tables = []
     for table_id in table_ids:
         t = Table.get_table_by_id(table_id)
         self.tables.append(t)
         t.add_reservation(self)
Example #2
0
def test_next_string_multiple_reservations_single_table_after():
    test_note = Note(None)
    table1 = [1, 2]
    table2 = [3, 4]
    time1 = datetime.strptime('Apr 1 2020 7:30PM', '%b %d %Y %I:%M%p')
    time2 = datetime.strptime('Apr 1 2020 7:45PM', '%b %d %Y %I:%M%p')
    res1 = (table1, time1)
    res2 = (table2, time2)
    assert test_note._next_string([res1,
                                   res2]) == "# Next: T1T2@7:30PM, T3T4@7:45PM"
Example #3
0
def test_remove_header_only_next_string():
    test_note = Note("# Next: T1@7:45PM")
    assert test_note.remove_header() == None
Example #4
0
def test_remove_header_only_out_string():
    test_note = Note("# Out @ 7:45PM")
    assert test_note.remove_header() == None
Example #5
0
def test_remove_header_no_current_note():
    test_note = Note(None)
    assert test_note.remove_header() == None
Example #6
0
def test_has_header_returns_true_header_with_notes():
    test_note = Note("# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.")
    assert test_note.has_header() == True
Example #7
0
def test_has_header_returns_true_only_header():
    test_note = Note("# Out @ 7:45PM\n# Next: T1@7:45PM")
    assert test_note.has_header() == True
Example #8
0
def test_has_header_returns_true_only_nextstring():
    test_note = Note("# Next: T1@7:45PM")
    assert test_note.has_header() == True
Example #9
0
def empty_note():
    return Note(None)
Example #10
0
def test_notes_has_header_returns_false_on_none_note():
    test_note = Note(None)
    assert test_note.has_header() == False
Example #11
0
def test_set_header_with_multiple_line_note():
    test_note = Note(
        "# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.\nSome other notes.")
    assert test_note.set_header("# Out @ 6:45PM", "# Next: T1@7:00PM") == \
    "# Out @ 6:45PM\n# Next: T1@7:00PM\nSome notes.\nSome other notes."
Example #12
0
def test_set_header_with_note():
    test_note = Note("# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.")
    assert test_note.set_header("# Out @ 6:45PM", "# Next: T1@7:00PM") == \
    "# Out @ 6:45PM\n# Next: T1@7:00PM\nSome notes."
Example #13
0
def test_set_header_only_next_string():
    test_note = Note("# Next: T1@7:45PM")
    assert test_note.set_header(
        "# Out @ 6:45PM",
        "# Next: T1@7:00PM") == "# Out @ 6:45PM\n# Next: T1@7:00PM"
Example #14
0
def test_set_header_no_current_note():
    test_note = Note(None)
    assert test_note.set_header(
        "# Out @ 6:45PM",
        "# Next: T1@7:00PM") == "# Out @ 6:45PM\n# Next: T1@7:00PM"
Example #15
0
def test_remove_header_with_note():
    test_note = Note("# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.")
    assert test_note.remove_header() == 'Some notes.'
Example #16
0
def test_remove_header_with_multiple_line_note():
    test_note = Note(
        "# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.\nSome other notes.")
    assert test_note.remove_header() == "Some notes.\nSome other notes."
Example #17
0
def test_has_header_returns_true_only_outstring():
    test_note = Note("# Out @ 7:45PM")
    assert test_note.has_header() == True