Пример #1
0
def test_MKOrder_alt3(sys):
    burger1 = Burger()
    whiteBun1 = Ingredient('White Bun', sys.getStockBasePrice('White Bun'), 4)
    beefPatty1 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 2)
    lettuce1 = Ingredient("Lettuce", sys.getStockBasePrice("Lettuce"), 3)

    error1 = burger1.addBuns(whiteBun1)
    error2 = burger1.addPatties(beefPatty1)
    burger1.addIngredient(lettuce1)

    assert error1 == None
    assert error2 == None
    assert burger1.calculatePrice() == 31

    wrap1 = Wrap()
    wholemealWrap1 = Ingredient('Wholemeal Wrap', sys.getStockBasePrice('Wholemeal Wrap'), 1)
    chickenPatty2 = Ingredient("Chicken Patty", sys.getStockBasePrice('Chicken Patty'), 2)

    error3 = wrap1.addWrap(wholemealWrap1)
    error4 = wrap1.addPatties(chickenPatty2)

    assert error3 == None
    assert error4 == None
    assert wrap1.calculatePrice() == 11

    # order.addMain(burger1)
    # order.addMain(wrap1)
    print("======= receipt ========")
    order2 = sys.makeOrder([burger1, wrap1], [], "preparing", 4)
    print('========================')
    assert order2.totalPrice() == 42
    print("test 4 passed")
Пример #2
0
def test_us3_245(sys):

    # make a burger
    burger32 = Burger()
    whiteBun32 = Ingredient('White Bun', sys.getStockBasePrice('White Bun'), 4)
    beefPatty32 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 2)
    lettuce32 = Ingredient("Lettuce", sys.getStockBasePrice("Lettuce"), 4)
    burger32.addBuns(whiteBun32)
    burger32.addPatties(beefPatty32)
    burger32.addIngredient(lettuce32)

    burger_price = burger32.calculatePrice()
    assert burger_price == 32

    #make a wrap
    wrap32 = Wrap()
    wholemealWrap32 = Ingredient('Wholemeal Wrap', sys.getStockBasePrice('Wholemeal Wrap'), 1)
    chickenPatty32 = Ingredient("Chicken Patty", sys.getStockBasePrice('Chicken Patty'), 2)
    beefPatty3 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 1)
    wrap32.addIngredient(wholemealWrap32)
    wrap32.addPatties(chickenPatty32)
    wrap32.addPatties(beefPatty3)

    wrap_price = wrap32.calculatePrice()
    assert wrap_price == 21

    drink32 = Extra()
    coke32 = Ingredient("Small Coca Cola", sys.getStockBasePrice("Can Coca Cola"), 2)
    drink32.addExtra(coke32)
    assert coke32.quantity == 2

    drink_price = drink32.calculatePrice()
    assert drink_price == 6
    print("========= receipt ===========")
    order = sys.makeOrder([burger32,wrap32], [drink32],'Preparing', 4)
    print("=============================")
    assert order.totalPrice() == 59
    #assert len([]) == 2
    #assert len(order32.extraFoods) == 1
    #totalPrice = order32.totalPrice()
    #assert totalPrice == 59

    print("test us3_245 have finished\n")
Пример #3
0
def testMKOrder(sys):
    #order = Order('parparing',1)
    burger = Burger()
    muffinBun1 = Ingredient("Muffin Bun", sys.getStockBasePrice("Muffin Bun"), 2)
    beefPatty1 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 1)
    sys.reduceStock(muffinBun1)
    sys.reduceStock(beefPatty1)
    burger.addBuns(muffinBun1)
    burger.addPatties(beefPatty1)

    side = Extra()
    chickenNuggetL1 = Ingredient('Large Chicken Nuggets',sys.getStockBasePrice("Large Chicken Nuggets"),1)

    side.addExtra(chickenNuggetL1)

    print("======= receipt ========")
    order1 = sys.makeOrder([burger],[side],'parparing',1)
    print('========================')
    #assert error == None
    assert burger.calculatePrice() == 18
    assert side.calculatePrice() == 7
    assert order1.totalPrice() == 25
    #assert len(sys.orders) == 1
    print('test 1 passed')
Пример #4
0
side = Extra()
chickenNuggetL1 = Ingredient('Large Chicken Nuggets',
                             sys.getStockBasePrice("Large Chicken Nuggets"), 1)
side.addExtra(chickenNuggetL1)
order1 = sys.makeOrder([burger], [side], 'Preparing', 1)

burger32 = Burger()
whiteBun32 = Ingredient('White Bun', sys.getStockBasePrice('White Bun'), 4)
beefPatty32 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 2)
lettuce32 = Ingredient("Lettuce", sys.getStockBasePrice("Lettuce"), 4)
burger32.addBuns(whiteBun32)
burger32.addPatties(beefPatty32)
burger32.addIngredient(lettuce32)

burger_price = burger32.calculatePrice()
assert burger_price == 32

# make a wrap
wrap32 = Wrap()
wholemealWrap32 = Ingredient('Wholemeal Wrap',
                             sys.getStockBasePrice('Wholemeal Wrap'), 1)
chickenPatty32 = Ingredient("Chicken Patty",
                            sys.getStockBasePrice('Chicken Patty'), 2)
beefPatty3 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 1)
wrap32.addIngredient(wholemealWrap32)
wrap32.addPatties(chickenPatty32)
wrap32.addPatties(beefPatty3)
wrap_price = wrap32.calculatePrice()
drink32 = Extra()
coke32 = Ingredient("Small Coca Cola", sys.getStockBasePrice("Can Coca Cola"),