Exemplo n.º 1
0
def test_remIngredient_incorrect_input_no_ings_in_order():
    sys = System()
    wrap = Main('wrap')
    sys.addQuantityIngredient('beef patty', 'm', 50, 1.50)
    ing1 = sys.ingredients[0]

    with pytest.raises(UserError) as error:
        wrap.remIngredient(ing1, 1, None)
    assert "You don't have any ingredients in your main to remove." in str(error.value)
Exemplo n.º 2
0
def test_remIngredient_incorrect_input():
    sys = System()
    sys.addQuantityIngredient('beef patty', 'm', 50, 1.50)
    sys.addQuantityIngredient('cheese', 'm', 50, 1.00)
    sys.addQuantityIngredient('egg', 'm', 50, 1.50)
    ing1 = sys.ingredients[0]
    ing2 = sys.ingredients[1]
    ing3 = sys.ingredients[2]

    wrap = Main('wrap')
    wrap.addIngredient(ing1, 2, None)
    wrap.addIngredient(ing2, 2, None)
    with pytest.raises(UserError) as error:
        wrap.remIngredient(ing3, 1, None)
    assert "You don't have any egg in your order to remove." in str(error.value)
Exemplo n.º 3
0
def test_remIngredient_correct_input():
    sys = System()
    sys.addQuantityIngredient('beef patty', 'm', 50, 1.50)
    sys.addQuantityIngredient('cheese', 'm', 50, 1.00)
    sys.addQuantityIngredient('egg', 'm', 50, 1.50)
    ing1 = sys.ingredients[0]
    ing2 = sys.ingredients[1]
    ing3 = sys.ingredients[2]

    wrap = Main('wrap')
    wrap.addIngredient(ing1, 2, None)
    wrap.addIngredient(ing2, 2, None)
    wrap.addIngredient(ing3, 1, None)

    wrap.remIngredient(ing3, 1, None)
    assert len(wrap.ingredients) == 2
    assert sys.ingredients[2].stock == 50