예제 #1
0
def test_complete_order_list(inventory_fixture, ingredient_cost_fixture):
    system1 = System(inventory_fixture, ingredient_cost_fixture)
    assert (isinstance(system1, System))
    order1 = system1.Create_Order()
    assert (isinstance(order1, Order))

    burg1 = order1.Create_Item("Burger")
    burg1.Bun_Type = "white"
    burg1.Add_Bun()
    burg1.Add_Bun()
    burg1.Patty_Type = "beef"
    burg1.Add_Patty()
    burg1.Add_Other("cheese")
    order1.Add_To_Order(burg1)
    assert (burg1 in order1.Items)
    assert (order1.Calculate_Cost() == 9)

    system1.Submit_Order(order1)
    assert (order1 in system1.View_Incomplete_Orders())
    assert (order1 not in system1.View_Complete_Orders())
    system1.Preparing_Order(order1)
    assert (order1 not in system1.View_Complete_Orders())
    assert (order1 in system1.View_Incomplete_Orders())
    system1.Complete_Order(order1)
    assert (order1 not in system1.View_Incomplete_Orders())
    assert (order1 in system1.View_Complete_Orders())
예제 #2
0
def test_view_order(inventory_fixture, ingredient_cost_fixture):
    system1 = System(inventory_fixture, ingredient_cost_fixture)
    assert (isinstance(system1, System))
    order1 = system1.Create_Order()
    assert (isinstance(order1, Order))

    burg1 = order1.Create_Item("Burger")
    burg1.Bun_Type = "white"
    burg1.Add_Bun()
    burg1.Add_Bun()
    burg1.Patty_Type = "beef"
    burg1.Add_Patty()
    burg1.Add_Other("cheese")
    order1.Add_To_Order(burg1)

    try:
        system1.View_Order(order1.ID)
    except SystemError as err:
        assert (err.message == "Order not found.")
    else:
        assert (False)

    system1.Submit_Order(order1)
    assert (system1.View_Order(order1.ID) == order1)

    system1.Preparing_Order(order1)
    assert (system1.View_Order(order1.ID) == order1)

    system1.Complete_Order(order1)
    assert (system1.View_Order(order1.ID) == order1)
예제 #3
0
def test_prepare_order_status(inventory_fixture, ingredient_cost_fixture):
    system1 = System(inventory_fixture, ingredient_cost_fixture)
    assert (isinstance(system1, System))
    order1 = system1.Create_Order()
    assert (isinstance(order1, Order))

    burg1 = order1.Create_Item("Burger")
    burg1.Bun_Type = "white"
    burg1.Add_Bun()
    burg1.Add_Bun()
    burg1.Patty_Type = "beef"
    burg1.Add_Patty()
    burg1.Add_Other("cheese")
    order1.Add_To_Order(burg1)
    assert (burg1 in order1.Items)
    assert (order1.Calculate_Cost() == 9)

    system1.Submit_Order(order1)
    assert (order1.Status == "Submitted")
    system1.Preparing_Order(order1)
    assert (order1.Status == "Preparing order")
예제 #4
0
def test_valid_order(inventory_fixture, ingredient_cost_fixture):
    system1 = System(inventory_fixture, ingredient_cost_fixture)
    assert (isinstance(system1, System))
    order1 = system1.Create_Order()
    assert (isinstance(order1, Order))

    orig_white_bun = system1._Inventory["white"]
    orig_beef = system1._Inventory["beef"]
    orig_cheese = system1._Inventory["cheese"]
    orig_tortilla = system1._Inventory["tortilla"]
    orig_tuna = system1._Inventory["tuna"]
    orig_lettuce = system1._Inventory["lettuce"]
    orig_onion = system1._Inventory["onion"]
    orig_tomato = system1._Inventory["tomato"]
    orig_avocado = system1._Inventory["avocado"]

    burg1 = order1.Create_Item("Burger")
    burg1.Bun_Type = "white"
    burg1.Add_Bun()
    burg1.Add_Bun()
    burg1.Patty_Type = "beef"
    burg1.Add_Patty()
    burg1.Add_Other("cheese")
    order1.Add_To_Order(burg1)
    assert (burg1 in order1.Items)
    assert (order1.Calculate_Cost() == 9)

    wrap1 = order1.Create_Item("Wrap")
    wrap1.Wrap_Type = "tortilla"
    wrap1.Filling_Type = "tuna"
    wrap1.Add_Other("cheese")
    wrap1.Add_Other("lettuce")
    wrap1.Add_Other("onion")
    wrap1.Add_Other("tomato")
    wrap1.Add_Other("avocado")
    order1.Add_To_Order(wrap1)
    assert (order1.Calculate_Cost() == 38.5)

    assert (system1.Inventory["white"] == (orig_white_bun - 2))
    assert (system1.Inventory["beef"] == (orig_beef - 1))
    assert (system1.Inventory["cheese"] == (orig_cheese - 2))
    assert (system1.Inventory["tortilla"] == (orig_tortilla - 1))
    assert (system1.Inventory["tuna"] == (orig_tuna - 1))
    assert (system1.Inventory["lettuce"] == (orig_lettuce - 1))
    assert (system1.Inventory["onion"] == (orig_onion - 1))
    assert (system1.Inventory["tomato"] == (orig_tomato - 1))
    assert (system1.Inventory["avocado"] == (orig_avocado - 1))

    assert (order1.ID == None)
    assert (order1.Status == None)
    try:
        system1.Check_Status(0)
    except SystemError as err:
        assert (err.message == "Order not found.")
    else:
        assert (False)

    system1.Submit_Order(order1)

    assert (order1.ID == 0)
    assert (order1 in system1.View_Incomplete_Orders())
    assert (system1.Check_Status(0) == "Submitted")

    system1.Preparing_Order(order1)

    assert (order1.ID == 0)
    assert (system1.Check_Status(0) == "Preparing order")
    assert (order1 in system1.View_Incomplete_Orders())

    system1.Complete_Order(order1)

    assert (order1.ID == 0)
    assert (system1.Check_Status(0) == "Completed")
    assert (order1 in system1.View_Complete_Orders())
예제 #5
0
    "coke": 3.5,
}

system1 = System(Inventory, Ingredient_costs)
print(system1)

order1 = system1.Create_Order()

burg1 = order1.Create_Item("Burger")
burg1.Bun_Type = "white"
burg1.Add_Bun()
burg1.Add_Bun()
burg1.Patty_Type = "beef"
burg1.Add_Patty()
burg1.Add_Other("cheese")
print(f"burg1 costs {burg1.Calculate_Cost()}")
order1.Add_To_Order(burg1)
print(f"order1 costs {order1.Calculate_Cost()}\n")
system1.Submit_Order(order1)

# UC13 - Acceptance Criteria: 1
# UC16 - Acceptance Criteria: 1
print(system1)

system1.Preparing_Order(order1)

print(f"The status of order 1 is: {(system1.Check_Status(order1.ID))}")

system1.Complete_Order(order1)
print(f"The status of order 1 is: {(system1.Check_Status(order1.ID))}")
print(system1)