class TestMakeComplexWrap(): def setup_method(self): self.newSystem = onlineOrderSystem() ingred1 = self.newSystem.pantry.createNewIngredient( "Tortillas", 1, 100) ingred2 = self.newSystem.pantry.createNewIngredient( "Chicken", 1.5, 100) ingred3 = self.newSystem.pantry.createNewIngredient("Onions", 0.1, 100) ingred4 = self.newSystem.pantry.createNewIngredient("Hommus", 2.5, 30) self.newSystem.pantry.addMainIngredient(ingred1) self.newSystem.pantry.addMainIngredient(ingred2) self.newSystem.pantry.addMainIngredient(ingred3) self.newSystem.pantry.addMainIngredient(ingred4) self.newMain = Main() def test_checkStoredInMainIngredients(self): assert (len(self.newSystem.pantry.mainIngredients) == 4) def test_createWrapWithExtras(self): assert (self.newMain.createBaseWrap(self.newSystem.pantry) == True) assert (len(self.newMain.baseIngredients) == 2) assert (self.newMain.netMainPrice == 2.5) assert (len(self.newMain.extraIngredients) == 0) assert (self.newSystem.pantry.findMain("Tortillas").quantity == 99) assert (self.newSystem.pantry.findMain("Chicken").quantity == 99) assert (self.newMain.addExtraIngredientBasic(self.newSystem.pantry, "Onions", 10) == True) assert (len(self.newMain.extraIngredients) == 1) assert (self.newSystem.pantry.findMain("Onions").quantity == 90) assert (self.newMain.netMainPrice == 3.5) assert (self.newMain.addExtraIngredientBasic(self.newSystem.pantry, "Hommus", 1) == True) assert (len(self.newMain.extraIngredients) == 2) assert (self.newSystem.pantry.findMain("Hommus").quantity == 29) assert (self.newMain.netMainPrice == 6) def test_cannotAddExtraInsufficientStock(self): assert (self.newMain.createBaseWrap(self.newSystem.pantry) == True) assert (len(self.newMain.baseIngredients) == 2) assert (self.newMain.netMainPrice == 2.5) assert (len(self.newMain.extraIngredients) == 0) assert (self.newSystem.pantry.findMain("Tortillas").quantity == 99) assert (self.newSystem.pantry.findMain("Chicken").quantity == 99) assert (self.newMain.addExtraIngredientBasic(self.newSystem.pantry, "Hommus", 200) == False) assert (len(self.newMain.extraIngredients) == 0) assert (self.newSystem.pantry.findMain("Hommus").quantity == 30) assert (self.newMain.netMainPrice == 2.5)
class TestMakeBasicWrap(): def setup_method(self): self.newSystem = onlineOrderSystem() ingred1 = self.newSystem.pantry.createNewIngredient( "Tortillas", 1, 100) ingred2 = self.newSystem.pantry.createNewIngredient( "Chicken", 1.5, 100) self.newSystem.pantry.addMainIngredient(ingred1) self.newSystem.pantry.addMainIngredient(ingred2) self.newMain = Main() def test_checkStoredInMainIngredients(self): assert (len(self.newSystem.pantry.mainIngredients) == 2) def test_correctlyInitialisedMain(self): newMain = Main() assert (self.newMain.netMainPrice == 0.0) assert (self.newMain.quantity == None) assert (len(self.newMain.baseIngredients) == 0) assert (len(self.newMain.extraIngredients) == 0) def test_createBaseWrap(self): assert (self.newMain.createBaseWrap(self.newSystem.pantry) == True) assert (len(self.newMain.baseIngredients) == 2) assert (self.newMain.netMainPrice == 2.5) assert (len(self.newMain.extraIngredients) == 0) assert (self.newSystem.pantry.findMain("Tortillas").quantity == 99) assert (self.newSystem.pantry.findMain("Chicken").quantity == 99)
class TestUnableToMakeBasicWrapDueToStock(): def setup_method(self): self.newSystem = onlineOrderSystem() ingred1 = self.newSystem.pantry.createNewIngredient("Tortillas", 1, 1) ingred2 = self.newSystem.pantry.createNewIngredient("Chicken", 1, 0) self.newSystem.pantry.addMainIngredient(ingred1) self.newSystem.pantry.addMainIngredient(ingred2) self.newMain = Main() def test_checkStoredInMainIngredients(self): assert (len(self.newSystem.pantry.mainIngredients) == 2) def test_unableToCreateBaseWrap(self): assert (self.newMain.createBaseWrap(self.newSystem.pantry) == None) assert (len(self.newMain.baseIngredients) == 0) assert (self.newMain.netMainPrice == 0) assert (len(self.newMain.extraIngredients) == 0) assert (self.newSystem.pantry.findMain("Tortillas").quantity == 1) assert (self.newSystem.pantry.findMain("Chicken").quantity == 0)