コード例 #1
0
ファイル: test_api.py プロジェクト: adamchainz/django-bazaar
    def test_get_stock_price_empty_stocks(self):
        product = ProductFactory()
        StockFactory(product=product, unit_price=2.0, quantity=0)
        StockFactory(product=product, unit_price=4.0, quantity=0)
        StockFactory(product=product, unit_price=3.0, quantity=0)

        with self.assertNumQueries(1):
            price = get_stock_price(product, Location.LOCATION_STORAGE)

        self.assertEqual(price, Money(3.0, "EUR"))
コード例 #2
0
ファイル: test_api.py プロジェクト: giok57/django-bazaar
    def test_get_stock_price_empty_stocks(self):
        product = ProductFactory()
        StockFactory(product=product, unit_price=2.0, quantity=0)
        StockFactory(product=product, unit_price=4.0, quantity=0)
        StockFactory(product=product, unit_price=3.0, quantity=0)

        with self.assertNumQueries(1):
            price = get_stock_price(product, Location.LOCATION_STORAGE)

        self.assertEqual(price, Money(3.0, "EUR"))
コード例 #3
0
ファイル: test_api.py プロジェクト: adamchainz/django-bazaar
 def test_get_stock_price_no_stocks(self):
     price = get_stock_price(ProductFactory(), Location.LOCATION_STORAGE)
     self.assertEqual(price, Money(0, "EUR"))
コード例 #4
0
ファイル: test_api.py プロジェクト: adamchainz/django-bazaar
 def test_get_stock_price(self):
     price = get_stock_price(self.product_a, Location.LOCATION_STORAGE)
     self.assertEqual(price, Money(2.6, "EUR"))
コード例 #5
0
ファイル: test_api.py プロジェクト: giok57/django-bazaar
 def test_get_stock_price_no_stocks(self):
     price = get_stock_price(ProductFactory(), Location.LOCATION_STORAGE)
     self.assertEqual(price, Money(0, "EUR"))
コード例 #6
0
ファイル: test_api.py プロジェクト: giok57/django-bazaar
 def test_get_stock_price(self):
     price = get_stock_price(self.product_a, Location.LOCATION_STORAGE)
     self.assertEqual(price, Money(2.6, "EUR"))