def test_us2_1(sys): #order21 = Order('preparing', 21) burger1 = Burger() muffinBun1 = Ingredient("Muffin Bun", sys.getStockBasePrice("Muffin Bun"), 2) beefPatty1 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 1) burger1.addBuns(muffinBun1) burger1.addPatties(beefPatty1) burger2 = Burger() GBun2 = Ingredient("Gluten Free Bun", sys.getStockBasePrice("Gluten Free Bun"), 4) beefPatty2 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 2) burger2.addBuns(GBun2) burger2.addPatties(beefPatty2) print("======= receipt ========") order5 = sys.makeOrder([burger1,burger2], [], 'preparing', 21) assert order5.totalPrice() == 50 assert len(order5.mainFoods) == 2 sys.reduceStock(muffinBun1) sys.reduceStock(beefPatty1) #sys.checkcheckSpecificInventory(muffinBun1) print("======= errors ========") error1 = sys.reduceStock(GBun2) sys.reduceStock(beefPatty2) print(error1) print('test us2_1 has finished') print('')
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")
def test_us2_2(sys): burger3 = Burger() whiteBun1 = Ingredient("White Bun", sys.getStockBasePrice("White Bun"), 2) beefPatty3 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 1) sys.reduceStock(whiteBun1) sys.reduceStock(beefPatty3) burger3.addBuns(whiteBun1) burger3.addPatties(beefPatty3) print("========= receipt ===========") sys.makeOrder([burger3], [], 'preparing', 2) print('==============================') #assert order22.extraFoods == None print('test us2_2 has finished')
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")
def test_us2_1_2(sys): burger12 = Burger() sweetbun12 = Ingredient("Sweet Bun", sys.getStockBasePrice("Sweet Bun"), 2) chickpatty12 = Ingredient("Chicken Patty", sys.getStockBasePrice('Chicken Patty'), 1) error12 = burger12.addBuns(sweetbun1) error12 = burger12.addPatties(chickpatty1) burger12 = Burger() sweetbun12 = Ingredient("Sweet Bun", sys.getStockBasePrice("Sweet Bun"), 2) chickpatty12 = Ingredient("Chicken Patty", sys.getStockBasePrice('Chicken Patty'), 1) error13 = burger12.addBuns(sweetbun12) error14 = burger12.addPatties(chickpatty12) error1 = sys.reduceStock() assert error13 == None assert error12 == None assert error1 == 'Sorry it is out stock' assert error14 == None print('test us2_1_2 has finished')
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')
def test_MKOrder_alt2(sys): order = Order('parparing',3) burger1 = Burger() whiteBun1 = Ingredient('White Bun',sys.getStockBasePrice('White Bun'),5) beefPatty1 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 8) lettuce1 = Ingredient("Lettuce", sys.getStockBasePrice('Lettuce'),3) error1 = burger1.addBuns(whiteBun1) error2 = burger1.addPatties(beefPatty1) burger1.addIngredient(lettuce1) print("=======error=======") print(error1) print(error2) print('===================') print('test 3 passed')
sys.addStock(wholemealWrap) sys.addStock(lettuce) sys.addStock(frenchFriesS) sys.addStock(frenchFriesL) sys.addStock(chickenNuggetS) sys.addStock(chickenNuggetL) sys.addStock(fanta) sys.addStock(chickPatty) sys.addStock(glutenfreeBun) 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) 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)