def setup(self): Catalogue().clear_catalogue() Offers().clear_offers() self.baked_bean = Item("BakedBean") self.sardines = Item("Sardines") self.biscuits = Item("Biscuits") self.shampoo_small = Item("Shampoo(Small)") self.shampoo_medium = Item("Shampoo (Medium)") self.shampoo_large = Item("Shampoo (Large)") catalogue = Catalogue() catalogue.add_item(self.baked_bean, 0.99, 100) catalogue.add_item(self.sardines, 1.89, 100) catalogue.add_item(self.biscuits, 1.20, 100) catalogue.add_item(self.shampoo_small, 2.00, 100) catalogue.add_item(self.shampoo_medium, 2.50, 100) catalogue.add_item(self.shampoo_large, 3.50, 100) baked_bean_offer = BuynGetmOffer("bakedBean2For1", 2, 1, self.baked_bean) sardines_offer = PercentOffer("Sardines25", 25, self.sardines) shampoo_offer = BuynOfXOffer( "ShampooSet3", 3, {self.shampoo_small, self.shampoo_medium, self.shampoo_large}) Offers().add_offer(baked_bean_offer) Offers().add_offer(sardines_offer) Offers().add_offer(shampoo_offer)
def test_there_is_only_one_catalogue(self): an_item, price, quantity = Item("Item1"), 2.0, 10 catalogue1 = Catalogue() catalogue1.add_item(an_item, price, quantity) catalogue2 = Catalogue() assert an_item in catalogue2.show_items()