Пример #1
0
 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))
Пример #2
0
 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))
Пример #3
0
def check_valid_cart(guest):
    shopping_cart = Consumer.guestShoppingCart[guest]
    i = 0
    if len(shopping_cart) == 0:
        return 'Shopping Cart Is Empty'
    while i < len(shopping_cart):
        item = get_item(shopping_cart[i].item_id)
        shop = search_shop(item.shop_name)
        if shop.status != 'Active':
            return 'Item ', item.name, ' Is Unavailable Because Shop is Not Active'
        i = i + 1
    return True
Пример #4
0
 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)
Пример #5
0
 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)
Пример #6
0
 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)