Пример #1
0
    def test_change_details_of_product(self):
        user1 = User("amir", 1)
        user1.identifier = 0
        user1.username = "******"
        user1.password = "******"
        user1.state = State.STORE_OWNER
        user1.is_logged_in = True

        store1 = Store("mega", 1, "123123", None, None)
        store1.store_number = 1

        product1 = Product('chocholate', 'Food', ['Food', 'Sweet'], 10)
        product1.catalog_number = 1

        store1.owners = [0]
        store1.add_new_product(product1)

        Ecommerce.get_instance().subscribers = [user1]
        Ecommerce.get_instance().stores = [store1]

        self.assertTrue(
            user1.change_details_of_product(1, "name", "whiteChocholate").val,
            "need return True")
        self.assertFalse(
            user1.change_details_of_product(2, "name", "whiteChocholate").val,
            "need return False")
Пример #2
0
 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")