Beispiel #1
0
def test_add_bun():
    inventory = Inventory()
    inventory.add_stock_type('Sesame', "bun", 0.69, 10, 1, 4, "discrete")
    assert inventory.food_list[0].name == "Sesame bun"
    assert inventory.food_list[0].price == 0.69
    assert inventory.food_list[0].max_allow == 4
    assert inventory.food_list[0].quant_type == ""
    assert inventory.food_list[0].ingredient_size == 1
    assert inventory.food_dict['Sesame bun'] == 10
Beispiel #2
0
def test_add_drink_ingredient():
    inventory = Inventory()
    inventory.add_stock_type("Yogurt", "side", 2.56, 200000, 75, 300, "ml")

    assert inventory.food_list[0].name == "Yogurt"
    assert inventory.food_list[0].price == 2.56
    assert inventory.food_list[0].max_allow == 300
    assert inventory.food_list[0].quant_type == "ml"
    assert inventory.food_list[0].ingredient_size == 75
    assert inventory.food_dict['Yogurt'] == 200000
Beispiel #3
0
def test_add_main_ingredient():
    inventory = Inventory()
    inventory.add_stock_type('tomato', "main", 0.2, 100000, 1, 20, "discrete")

    assert inventory.food_list[0].name == "tomato"
    assert inventory.food_list[0].price == 0.2
    assert inventory.food_list[0].max_allow == 20
    assert inventory.food_list[0].quant_type == "discrete"
    assert inventory.food_list[0].ingredient_size == 1
    assert inventory.food_dict['tomato'] == 100000
Beispiel #4
0
def test_add_patty():
    inventory = Inventory()
    inventory.add_stock_type('yeet', "patty", 3, 15, 1, 3, "discrete")

    assert inventory.food_list[0].name == "yeet patty"
    assert inventory.food_list[0].price == 3
    assert inventory.food_list[0].max_allow == 3
    assert inventory.food_list[0].quant_type == ""
    assert inventory.food_list[0].ingredient_size == 1
    assert inventory.food_dict['yeet patty'] == 15
Beispiel #5
0
def test_add_side_ingredient():
    inventory = Inventory()
    inventory.add_stock_type("Smoll fries", "side", 2.15, 10000, 75, 100000,
                             "g")

    assert inventory.food_list[0].name == "Smoll fries"
    assert inventory.food_list[0].price == 2.15
    assert inventory.food_list[0].max_allow == 100000
    assert inventory.food_list[0].quant_type == "g"
    assert inventory.food_list[0].ingredient_size == 75
    assert inventory.food_dict['Smoll fries'] == 10000
Beispiel #6
0
def test_update_stock_quantity_exception_negative_amount():
    inventory = Inventory()
    inventory.add_stock_type('Sesame', "bun", 0.69, 10, 1, 4, "discrete")
    assert inventory.food_list[0].name == "Sesame bun"
    assert inventory.food_list[0].price == 0.69
    assert inventory.food_list[0].max_allow == 4
    assert inventory.food_list[0].quant_type == ""
    assert inventory.food_list[0].ingredient_size == 1
    assert inventory.food_dict['Sesame bun'] == 10

    with pytest.raises(UpdateQuantityError) as e:
        inventory.update_stock_quantity('Sesame bun', "abcdde")
    assert str(e.value) == 'Quantity must be an integer'
Beispiel #7
0
def test_add_stock_exception_empty_price():
    inventory = Inventory()

    with pytest.raises(AddStockError) as e:
        inventory.add_stock_type("Yogurt", "side", "", 200000, 75, 300, "ml")
    assert str(e.value) == 'price'
Beispiel #8
0
def test_add_stock_exception_no_name():
    inventory = Inventory()

    with pytest.raises(AddStockError) as e:
        inventory.add_stock_type(None, "side", 2.56, 200000, 75, 300, "ml")
    assert str(e.value) == 'name'
Beispiel #9
0
def test_add_stock_exception_negative_max():
    inventory = Inventory()

    with pytest.raises(AddStockError) as e:
        inventory.add_stock_type("Yogurt", "side", 20, 200000, 75, -300, "ml")
    assert str(e.value) == 'max_allow'
Beispiel #10
0
def test_add_stock_exception_negative_ing_size():
    inventory = Inventory()

    with pytest.raises(AddStockError) as e:
        inventory.add_stock_type("Yogurt", "side", 20, 200000, -75, 300, "ml")
    assert str(e.value) == 'ingredient_size'
Beispiel #11
0
def test_add_stock_exception_negative_amount():
    inventory = Inventory()

    with pytest.raises(AddStockError) as e:
        inventory.add_stock_type("Yogurt", "side", 2, -200000, 75, 300, "ml")
    assert str(e.value) == 'amount'
Beispiel #12
0
def test_add_bun():
    # How would I make different stuff have different prices
    inventory = Inventory()
    # Add buns

    inventory.add_stock_type('sesame', "bun", 0.69, 10, 1, 4, "discrete")
Beispiel #13
0
def gourmet_fixture():
    # How would I make different stuff have different prices
    inventory = Inventory()
    # Add buns
    for bun in ["Sesame", "Muffin", "Mad", "Burnt"]:
        inventory.add_stock_type(bun, "bun", 0.69, 10, 1, 4, "discrete")
    # Add wrap
    inventory.add_stock_type("Wrap", "main", 6.69, 12, 1, float("inf"), "discrete")
    # Add patties
    for patty in ["Chicken", "Vegetarian", "Beef"]:
        inventory.add_stock_type(patty, "patty", 6.66, 20, 1, 3, "discrete")
    # Add other main _ingredients
    inventory.add_stock_type("Base", "main", 5.50, 50, 1, float("inf"), "discrete")
    for misc in ["Tomato", "Lettuce", "Tomato sauce", "Cheddar cheese", "Swiss Cheese"]:
        inventory.add_stock_type(misc, "main", 0.66, 69, 1, float("inf"), "discrete")
    # Add sides
    for side in ["6 pack nuggets", "3 pack nuggets", "Small fries", "Medium fries", "Large fries", "Wiked wingz"]:
        inventory.add_stock_type(side, "side", 4.20, 101, 3, float("inf"), "g")
    # Add _drinks
    for drink in ["Cokain", "Mtn Dew", "Vodka", "Baijiu", "Sake", "Whiskey"]:
        inventory.add_stock_type(drink, "drink", 69, 11, 1, float("inf"), "ml")

    return inventory