本文整理汇总了Python中oscar.apps.basket.models.Basket.is_submitted方法的典型用法代码示例。如果您正苦于以下问题:Python Basket.is_submitted方法的具体用法?Python Basket.is_submitted怎么用?Python Basket.is_submitted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oscar.apps.basket.models.Basket
的用法示例。
在下文中一共展示了Basket.is_submitted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestABasket
# 需要导入模块: from oscar.apps.basket.models import Basket [as 别名]
# 或者: from oscar.apps.basket.models.Basket import is_submitted [as 别名]
class TestABasket(TestCase):
def setUp(self):
self.basket = Basket()
self.product = create_product()
def test_an_empty_basket_has_zero_lines(self):
self.assertEqual(0, self.basket.num_lines)
def test_new_baskets_are_empty(self):
self.assertTrue(self.basket.is_empty)
def test_adding_product_creates_line(self):
self.basket.add_product(self.product)
self.assertEqual(1, self.basket.num_lines)
def test_adding_multiproduct_line_returns_correct_number_of_items(self):
self.basket.add_product(self.product, 10)
self.assertEqual(self.basket.num_items, 10)
self.assertEqual(self.basket.num_lines, 1)
def test_add_product_creates_line(self):
self.basket.add_product(self.product)
self.assertTrue(self.basket.num_lines == 1)
def test_add_product_sets_line_prices(self):
self.basket.add_product(self.product)
basket_line = self.basket.lines.all()[0]
self.assertEqual(basket_line.price_incl_tax, D('10.00'))
self.assertEqual(basket_line.price_excl_tax, D('10.00'))
def test_flushing_basket_removes_all_lines(self):
self.basket.add_product(self.product, 10)
self.assertEqual(self.basket.num_items, 10)
self.basket.flush()
self.assertEqual(self.basket.num_items, 0)
def test_returns_correct_quantity_for_missing_product(self):
self.assertEqual(0, self.basket.line_quantity(self.product))
def test_returns_correct_quantity_for_existing_product(self):
self.basket.add_product(self.product)
self.assertEqual(1, self.basket.line_quantity(self.product))
def test_returns_correct_quantity_for_existing_product_with_options(self):
option = Option.objects.create(name="Message")
options = [{"option": option, "value": "2"}]
self.basket.add_product(self.product, options=options)
self.assertEqual(0, self.basket.line_quantity(self.product))
self.assertEqual(1, self.basket.line_quantity(self.product, options))
self.assertEqual(1, self.basket.product_quantity(self.product))
def test_has_method_to_test_if_submitted(self):
self.basket.set_as_submitted()
self.assertTrue(self.basket.is_submitted())