当前位置: 首页>>代码示例>>Python>>正文


Python CourseFactory.create_batch方法代码示例

本文整理汇总了Python中courses.tests.factories.CourseFactory.create_batch方法的典型用法代码示例。如果您正苦于以下问题:Python CourseFactory.create_batch方法的具体用法?Python CourseFactory.create_batch怎么用?Python CourseFactory.create_batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在courses.tests.factories.CourseFactory的用法示例。


在下文中一共展示了CourseFactory.create_batch方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_courses_by_number

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
 def test_get_courses_by_number(self):
     c1, c2 = CourseFactory.create_batch(2, number=1337)
     c3, c4 = CourseFactory.create_batch(2)
     json = self.json_get('v4:courses', get='?number=1337', status_code=200)
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(c1),
             self.to_dict(c2),
         ]
     })
开发者ID:Radzell,项目名称:YACS,代码行数:14,代码来源:tests.py

示例2: test_get_courses_by_dept_id

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
 def test_get_courses_by_dept_id(self):
     d = DepartmentFactory.create(code='CSCI')
     c1, c2 = CourseFactory.create_batch(2, department=d)
     c3, c4 = CourseFactory.create_batch(2)
     json = self.json_get(
         'v4:courses', get='?department_id=%s' % d.id, status_code=200)
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(c1),
             self.to_dict(c2),
         ]
     })
开发者ID:Radzell,项目名称:YACS,代码行数:16,代码来源:tests.py

示例3: test_search_department_name

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
 def test_search_department_name(self):
     c1, c2 = CourseFactory.create_batch(2)
     d = DepartmentFactory.create(name='Computer Science')
     c3, c4 = CourseFactory.create_batch(2, department=d)
     json = self.json_get(
         'v4:courses', get='?search=Computer', status_code=200)
     self.maxDiff = None
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(c3),
             self.to_dict(c4),
         ],
     })
开发者ID:Radzell,项目名称:YACS,代码行数:17,代码来源:tests.py

示例4: test_get_course_by_id

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
 def test_get_course_by_id(self):
     c1, c2 = CourseFactory.create_batch(2)
     json = self.json_get('v4:courses', id=c1.id, status_code=200)
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": self.to_dict(c1),
     })
开发者ID:Radzell,项目名称:YACS,代码行数:10,代码来源:tests.py

示例5: test_search_name

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
 def test_search_name(self):
     c1, c2 = CourseFactory.create_batch(2)
     c3 = CourseFactory.create(name="Cakes for Dummies")
     json = self.json_get(
         'v4:courses', get='?search=cakes dum', status_code=200)
     self.maxDiff = None
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [self.to_dict(c3)],
     })
开发者ID:Radzell,项目名称:YACS,代码行数:13,代码来源:tests.py

示例6: test_search_department_code

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
 def test_search_department_code(self):
     c1, c2 = CourseFactory.create_batch(2)
     d = DepartmentFactory.create(code='CSCI')
     c3 = CourseFactory.create(department=d)
     json = self.json_get(
         'v4:courses', get='?search=CSCI', status_code=200)
     self.maxDiff = None
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [self.to_dict(c3)],
     })
开发者ID:Radzell,项目名称:YACS,代码行数:14,代码来源:tests.py

示例7: test_get_courses

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
 def test_get_courses(self):
     c1, c2, c3 = CourseFactory.create_batch(3)
     json = self.json_get('v4:courses', status_code=200)
     self.maxDiff = None
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(c1),
             self.to_dict(c2),
             self.to_dict(c3),
         ]
     })
开发者ID:Radzell,项目名称:YACS,代码行数:15,代码来源:tests.py

示例8: test_get_courses_by_ids

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
 def test_get_courses_by_ids(self):
     c1, c2, c3, c4 = CourseFactory.create_batch(4)
     json = self.json_get(
         'v4:courses',
         get='?id=%d&id=%d' % (c1.id, c3.id),
         status_code=200)
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(c1),
             self.to_dict(c3),
         ]
     })
开发者ID:Radzell,项目名称:YACS,代码行数:16,代码来源:tests.py

示例9: test_search_instructor

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
 def test_search_instructor(self):
     c1, c2 = CourseFactory.create_batch(2)
     c3 = CourseFactory.create()
     sec = SectionFactory.create(course=c3)
     sp = SectionPeriodFactory.create(section=sec, instructor='Moorthy')
     json = self.json_get('v4:courses', get='?search=moor', status_code=200)
     self.maxDiff = None
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(c3),
         ]
     })
开发者ID:Radzell,项目名称:YACS,代码行数:16,代码来源:tests.py

示例10: test_get_semester_by_course

# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import create_batch [as 别名]
    def test_get_semester_by_course(self):
        c1, c2 = CourseFactory.create_batch(2)
        OfferedForFactory.create(semester=self.s1, course=c1)
        OfferedForFactory.create(semester=self.s2, course=c2)
        json = self.json_get('v4:semesters', get='?course_id=%d' % c2.id)

        # for some odd reason, accuracy is lost for datetimes.
        for row in json['result']:
            row['date_updated'] = row['date_updated'][:-7]

        self.assertEqual(json, {
            u"version": 4,
            u"success": True,
            u"result": [self.as_dict(self.s2)],
        })
开发者ID:Radzell,项目名称:YACS,代码行数:17,代码来源:tests.py


注:本文中的courses.tests.factories.CourseFactory.create_batch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。