Example #1
0
def book_event():
    print("*********************************************")
    print("* TABLE OPEN: Find your dinner reservation! *")
    print("*********************************************")
    print()

    print("What type of food are you in the mood for?")
    print("1. Thai")
    print("2. Burgers")
    print("3. Seafood")
    print("4. Other")
    choice = input("Choose a number: ")
    choice = int(choice)

    options = core.find_available(choice)

    print()
    if not options:
        print("Whoops, no tables for that food type. Try another.")
        return

    print("Here are the open tables:")
    for idx, o in enumerate(options):
        print("{}. Restaurant: {}, table: {}.".format(idx + 1, o.restaurant,
                                                      o.table_id))

    print()
    num = int(input("Enter a number of the table to book: ")) - 1

    to_book = options[num]
    booked = core.book_table(to_book.table_id)
    print("Booked you a table at {} in table {}".format(
        booked.restaurant, booked.table_id))
def book_event():
    print("*********************************************")
    print("* TABLE OPEN: Find your dinner reservation! *")
    print("*********************************************")
    print()

    print("What type of food are you in the mood for?")
    print("1. Thai")
    print("2. Burgers")
    print("3. Seafood")
    print("4. Other")
    choice = input("Choose a number: ")
    choice = int(choice)

    options = core.find_available(choice)

    print()
    if not options:
        print("Whoops, no tables for that food type. Try another.")
        return

    print("Here are the open tables:")
    for idx, o in enumerate(options):
        print("{}. Restaurant: {}, table: {}.".format(idx + 1, o.restaurant, o.table_id))

    print()
    num = int(input("Enter a number of the table to book: ")) - 1

    to_book = options[num]
    booked = core.book_table(to_book.table_id)
    print("Booked you a table at {} in table {}".format(booked.restaurant, booked.table_id))
Example #3
0
def test_there_are_tables_available():
    choice = 1
    tables = core.find_available(choice)

    assert len(tables) > 0
Example #4
0
def test_cannot_book_a_booked_table():
    with pytest.raises(core.TableUnavailableError):
        # TODO: verify you cannot book a table that is already booked
        table = core.find_available(1)[0]
        table.is_booked = True
        core.book_table(table.table_id)
def test_there_are_tables_available():
    choice = 1
    one_tables = core.find_available(choice)

    assert len(one_tables)
Example #6
0
def home(request):
    return render_to_response('index.html', {'name': find_available()})