本文整理汇总了Python中shoppingcart.models.PaidCourseRegistration.part_of_order方法的典型用法代码示例。如果您正苦于以下问题:Python PaidCourseRegistration.part_of_order方法的具体用法?Python PaidCourseRegistration.part_of_order怎么用?Python PaidCourseRegistration.part_of_order使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shoppingcart.models.PaidCourseRegistration
的用法示例。
在下文中一共展示了PaidCourseRegistration.part_of_order方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_to_order
# 需要导入模块: from shoppingcart.models import PaidCourseRegistration [as 别名]
# 或者: from shoppingcart.models.PaidCourseRegistration import part_of_order [as 别名]
def test_add_to_order(self):
reg1 = PaidCourseRegistration.add_to_order(self.cart, self.course_id)
self.assertEqual(reg1.unit_cost, self.cost)
self.assertEqual(reg1.line_cost, self.cost)
self.assertEqual(reg1.unit_cost, self.course_mode.min_price)
self.assertEqual(reg1.mode, "honor")
self.assertEqual(reg1.user, self.user)
self.assertEqual(reg1.status, "cart")
self.assertTrue(PaidCourseRegistration.part_of_order(self.cart, self.course_id))
self.assertFalse(PaidCourseRegistration.part_of_order(self.cart, self.course_id + "abcd"))
self.assertEqual(self.cart.total_cost, self.cost)
示例2: test_add_with_default_mode
# 需要导入模块: from shoppingcart.models import PaidCourseRegistration [as 别名]
# 或者: from shoppingcart.models.PaidCourseRegistration import part_of_order [as 别名]
def test_add_with_default_mode(self):
"""
Tests add_to_cart where the mode specified in the argument is NOT in the database
and NOT the default "honor". In this case it just adds the user in the CourseMode.DEFAULT_MODE, 0 price
"""
reg1 = PaidCourseRegistration.add_to_order(self.cart, self.course_id, mode_slug="DNE")
self.assertEqual(reg1.unit_cost, 0)
self.assertEqual(reg1.line_cost, 0)
self.assertEqual(reg1.mode, "honor")
self.assertEqual(reg1.user, self.user)
self.assertEqual(reg1.status, "cart")
self.assertEqual(self.cart.total_cost, 0)
self.assertTrue(PaidCourseRegistration.part_of_order(self.cart, self.course_id))
示例3: test_add_course_to_cart_success
# 需要导入模块: from shoppingcart.models import PaidCourseRegistration [as 别名]
# 或者: from shoppingcart.models.PaidCourseRegistration import part_of_order [as 别名]
def test_add_course_to_cart_success(self):
self.login_user()
resp = self.client.post(reverse('shoppingcart.views.add_course_to_cart', args=[self.course_id]))
self.assertEqual(resp.status_code, 200)
self.assertTrue(PaidCourseRegistration.part_of_order(self.cart, self.course_id))