def test_add_more_products_creates_correct_stocks_with_single_movement(self): self.product_1.move(from_location=self.lost_and_found, to_location=self.storage, quantity=2) self.product_2.move(from_location=self.lost_and_found, to_location=self.storage, quantity=3) self.assertEqual(get_storage_quantity(product=self.composite_1), 2) self.assertEqual(get_storage_quantity(product=self.composite_2), 1) self.assertEqual(get_storage_price(product=self.composite_1).amount, 1) self.assertEqual(get_storage_price(product=self.composite_2).amount, 5) self.assertEqual(get_storage_quantity(product=self.product_1), 2) self.assertEqual(get_storage_quantity(product=self.product_2), 3)
def test_add_one_product_creates_stock_only_for_composite_1(self): self.product_1.move(from_location=self.lost_and_found, to_location=self.storage, quantity=1, price_multiplier=2) self.assertEqual(get_storage_quantity(product=self.composite_1), 1) self.assertEqual(get_storage_price(product=self.composite_1).amount, 2) self.assertEqual(get_storage_quantity(product=self.composite_2), 0) self.assertEqual(get_storage_quantity(product=self.product_1), 1)
def cost(self): """ Returns global cost for the listing """ return api.get_storage_price(self.product)