def test_bad_man_remove_item_from_shop(self): register(RegisteredUser('TomerTomer', '1234567878')) shop = search_shop('My Shop') item1 = Item(1, 'My Shop', 'milk', 'diary', 'good', 12, 100, 'regular', None, 0, 0, 0) ItemsLogic.add_item_to_shop(item1, 'StoreManager1') searched_1 = search_item_in_shop(shop.name, item1.name) self.assertEqual(searched_1.id, item1.id) self.assertFalse(remove_item_from_shop(item1.id, 'TomerTomer')) self.assertTrue(search_item_in_shop(shop.name, item1.name))
def test_bad_shop_less_item_remove_item_from_shop(self): shop = search_shop('My Shop') item1 = Item(1, 'My Shop', 'milk', 'diary', 'good', 12, 100, 'regular', None, 0, 0, 0) item2 = Item(2, 'My Shop', 'steak', 'meat', 'bad', 12, 100, 'regular', None, 0, 0, 0) ItemsLogic.add_item_to_shop(item1, 'StoreManager1') searched_1 = search_item_in_shop(shop.name, item1.name) self.assertEqual(searched_1.id, item1.id) self.assertFalse(remove_item_from_shop(item2.id, 'StoreManager1')) self.assertTrue(search_item_in_shop(shop.name, item1.name))
def test_add_item_to_shop(self): shop = search_shop('My Shop') item1 = Item(1, 'My Shop', 'milk', 'diary', 'good', 12, 100, 'regular', None, 0, 0, 0) item2 = Item(2, 'My Shop', 'steak', 'meat', 'bad', 12, 100, 'regular', None, 0, 0, 0) ItemsLogic.add_item_to_shop(item1, 'StoreManager1') ItemsLogic.add_item_to_shop(item2, 'StoreManager1') searched_1 = search_item_in_shop(shop.name, item1.name) searched_2 = search_item_in_shop(shop.name, item2.name) # condition1 = check_in_stock(item1.id, 100) and check_in_stock(item2.id, 100) self.assertEqual(searched_1.id, item1.id) self.assertEqual(searched_2.id, item2.id)
def test_edit_shop_item(self): shop = search_shop('My Shop') item1 = Item(1, 'My Shop', 'milk', 'diary', 'good', 12, 100, 'regular', None, 0, 0, 0) item2 = Item(2, 'My Shop', 'steak', 'meat', 'bad', 12, 100, 'regular', None, 0, 0, 0) ItemsLogic.add_item_to_shop(item1, 'StoreManager1') ItemsLogic.add_item_to_shop(item2, 'StoreManager1') searched_1 = search_item_in_shop(shop.name, item1.name) searched_2 = search_item_in_shop(shop.name, item2.name) self.assertEqual(searched_1.id, item1.id) self.assertEqual(searched_2.id, item2.id) self.assertTrue(edit_shop_item('StoreManager1', item1.id, 'price', 15)) price = search_item_in_shop(shop.name, item1.name).price self.assertEqual(15, price)
def test_bad_no_man_edit_shop_item(self): register(RegisteredUser('TomerTomer', '1234567878')) shop = search_shop('My Shop') item1 = Item(1, 'My Shop', 'milk', 'diary', 'good', 12, 100, 'regular', None, 0, 0, 0) item2 = Item(2, 'My Shop', 'steak', 'meat', 'bad', 12, 100, 'regular', None, 0, 0, 0) ItemsLogic.add_item_to_shop(item1, 'StoreManager1') ItemsLogic.add_item_to_shop(item2, 'StoreManager1') searched_1 = search_item_in_shop(shop.name, item1.name) searched_2 = search_item_in_shop(shop.name, item2.name) self.assertEqual(searched_1.id, item1.id) self.assertEqual(searched_2.id, item2.id) self.assertFalse(edit_shop_item('TomerTomer', item1.id, 'price', 15)) price = search_item_in_shop(shop.name, item1.name).price self.assertEqual(12, price)