Beispiel #1
0
def test_remIngredient_correctinput():
    sys = System()
    sys.addQuantityIngredient('sesame bun', 'm', 20, 1.00)
    sys.addWeightIngredient('fries', 'm', 2000, 60, 100, 140, 2, 2.8, 3.4)
    sys.remIngredient(4)
    assert len(sys.ingredients) == 1
    assert sys.ingredients[0].name == 'sesame bun'
Beispiel #2
0
def test_addWeightIngredient_correct_input():
    sys = System()
    sys.addWeightIngredient('fries', 's', 2000, 60, 100, 140, 2, 2.8, 3.4)
    new = sys.ingredients[0]
    assert new.id == 2
    assert new.name == 'fries'
    assert new.kind == 's'
    assert new.stock == 2000
    assert new.sWeight == 60
    assert new.mWeight == 100
    assert new.lWeight == 140
    assert new.sPrice == 2
    assert new.mPrice == 2.8
    assert new.lPrice == 3.4
Beispiel #3
0
def test_addWeightIngredient_stock_is_string():
    sys = System()
    with pytest.raises(UserError) as e:
        sys.addWeightIngredient('ranch sauce', 'm', 'one hundred', 2, 3, 4, 5,
                                5, 4)
    assert 'Stock of ingredient must be in number' in str(e.value)
Beispiel #4
0
def test_addWeightIngredient_price_is_negative():
    sys = System()
    with pytest.raises(UserError) as e:
        sys.addWeightIngredient('fries', 'm', 100, 70, 90, 120, -4, -3, -1)
    assert 'All prices of ingredient must be positive' in str(e.value)
Beispiel #5
0
def test_addWeightIngredient_price_is_string():
    sys = System()
    with pytest.raises(UserError) as e:
        sys.addWeightIngredient('fries', 'm', 1000, 152, 400, 600, 'f', 'g',
                                'h')
    assert 'All prices of ingredient must be in number' in str(e.value)
Beispiel #6
0
def test_addWeightIngredient_weight_is_negative():
    sys = System()
    with pytest.raises(UserError) as e:
        sys.addWeightIngredient('fries', 'm', 1000, -70, -90, -120, 4, 3, 1)
    assert 'All weights of ingredient must be larger than zero' in str(e.value)
Beispiel #7
0
def test_addWeightIngredient_weight_is_string():
    sys = System()
    with pytest.raises(UserError) as e:
        sys.addWeightIngredient('fries', 'm', 1000, 'ewf', 'ewf', 'wef', 2.8,
                                3.4, 3.8)
    assert 'All weights of ingredient must be in number' in str(e.value)
Beispiel #8
0
def test_addWeightIngredient_stock_is_negative():
    sys = System()
    with pytest.raises(UserError) as e:
        sys.addWeightIngredient('fries', 'm', -1000, 60, 100, 140, 2, 2.8, 3.4)
    assert 'Stock of ingredient must be equal to or larger than 0' in str(
        e.value)