本文整理汇总了Python中courses.tests.factories.SectionPeriodFactory.create_batch方法的典型用法代码示例。如果您正苦于以下问题:Python SectionPeriodFactory.create_batch方法的具体用法?Python SectionPeriodFactory.create_batch怎么用?Python SectionPeriodFactory.create_batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类courses.tests.factories.SectionPeriodFactory
的用法示例。
在下文中一共展示了SectionPeriodFactory.create_batch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_sections_by_semester
# 需要导入模块: from courses.tests.factories import SectionPeriodFactory [as 别名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 别名]
def test_get_sections_by_semester(self):
sem = SemesterFactory.create()
s1, s2 = SectionPeriodFactory.create_batch(2, semester=sem)
s3, s4 = SectionPeriodFactory.create_batch(2)
json = self.json_get(
'v4:sections', get='?semester_id=%d' % sem.id, status_code=200)
self.assertEqual(json, {
u"version": 4,
u"success": True,
u"result": [
self.to_dict(s1),
self.to_dict(s2),
]
})
示例2: test_get_section_by_id
# 需要导入模块: from courses.tests.factories import SectionPeriodFactory [as 别名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 别名]
def test_get_section_by_id(self):
s1, s2 = SectionPeriodFactory.create_batch(2)
json = self.json_get('v4:sections', id=s1.id, status_code=200)
self.maxDiff = None
self.assertEqual(json, {
u"version": 4,
u"success": True,
u"result": self.to_dict(s1),
})
示例3: test_get_sections
# 需要导入模块: from courses.tests.factories import SectionPeriodFactory [as 别名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 别名]
def test_get_sections(self):
s1, s2, s3, s4 = SectionPeriodFactory.create_batch(4)
json = self.json_get('v4:sections', status_code=200)
self.assertEqual(json, {
u"version": 4,
u"success": True,
u"result": [
self.to_dict(s1),
self.to_dict(s2),
self.to_dict(s3),
self.to_dict(s4),
]
})
示例4: test_get_sections_by_crn
# 需要导入模块: from courses.tests.factories import SectionPeriodFactory [as 别名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 别名]
def test_get_sections_by_crn(self):
s1, s2, s3, s4 = SectionPeriodFactory.create_batch(4)
json = self.json_get(
'v4:sections',
get='?crn=%d&crn=%d' % (s1.section.crn, s3.section.crn),
status_code=200)
self.assertEqual(json, {
u"version": 4,
u"success": True,
u"result": [
self.to_dict(s1),
self.to_dict(s3),
]
})
示例5: test_get_sections_by_course
# 需要导入模块: from courses.tests.factories import SectionPeriodFactory [as 别名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 别名]
def test_get_sections_by_course(self):
c1 = CourseFactory.create()
sec1, sec2 = SectionFactory.create_batch(2, course=c1)
s1 = SectionPeriodFactory.create(section=sec1)
s2 = SectionPeriodFactory.create(section=sec2)
s3, s4 = SectionPeriodFactory.create_batch(2)
json = self.json_get(
'v4:sections', get='?course_id=%d' % c1.id, status_code=200)
self.assertEqual(json, {
u"version": 4,
u"success": True,
u"result": [
self.to_dict(s1),
self.to_dict(s2),
]
})