def test_remove_from_cart(self): #ok user1 = User("amir", 32) user1.identifier = 1 user1.state = State.STORE_OWNER product1 = Product('chocholate', 'Food', ['Food', 'Sweet'], 10) product1.catalog_number = 1 store1 = Store("ramiLevi", 0, "123123", None, None) store1.store_number = 0 store1.supervisor = 1 store1.add_new_product(product1) store1.owners = [user1.identifier] Ecommerce.get_instance().stores = [store1] self.assertTrue(user1.remove_product(0, 1).val, "need return True") self.assertFalse(user1.remove_product(0, 1).val, "need return False")
def test_remove_product(self): #ok user1 = User("amir", 12) user1.identifier = 0 store1 = Store("mega", 0, "456456", None, None) store1.store_number = 1 product1 = Product('chocholate', 'Food', ['Food', 'Sweet'], 10) product1.catalog_number = 1 store1.add_new_product(product1) Ecommerce.get_instance().stores = [store1] user1.state = State.GUEST self.assertFalse(user1.remove_product(1, 1).val, "need return False") user1.state = State.STORE_OWNER self.assertTrue(user1.remove_product(1, 1), "need return True") self.assertFalse(user1.remove_product(1, 10).val, "need return False")