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


Python DepartmentFactory.create_batch方法代码示例

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


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

示例1: test_get_department_by_id

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create_batch [as 别名]
    def test_get_department_by_id(self):
        d1, d2, d3 = DepartmentFactory.create_batch(3)
        json = self.json_get('v4:departments', id=d1.id, status_code=200)

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

示例2: test_get_departments_by_code

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create_batch [as 别名]
    def test_get_departments_by_code(self):
        d1, d2, d3 = DepartmentFactory.create_batch(3)
        d4 = DepartmentFactory.create(code='FOO')

        json = self.json_get(
            'v4:departments', get='?code=FOO', status_code=200)

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

示例3: test_get_departments

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create_batch [as 别名]
    def test_get_departments(self):
        d1, d2, d3, d4 = DepartmentFactory.create_batch(4)
        json = self.json_get('v4:departments', status_code=200)

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

示例4: test_get_departments_by_ids

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create_batch [as 别名]
    def test_get_departments_by_ids(self):
        d1, d2, d3 = DepartmentFactory.create_batch(3)
        json = self.json_get(
            'v4:departments', get='?id=%d&id=%d' % (d1.id, d2.id),
            status_code=200)

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

示例5: test_get_departments_by_courses

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create_batch [as 别名]
    def test_get_departments_by_courses(self):
        d1, d2, d3 = DepartmentFactory.create_batch(3)
        c1 = CourseFactory.create(department=d1)
        c2 = CourseFactory.create(department=d2)
        c3 = CourseFactory.create(department=d3)

        json = self.json_get(
            'v4:departments',
            get='?course_id=%d&course_id=%d' % (c1.id, c2.id),
            status_code=200)

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

示例6: test_get_departments_by_semester

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create_batch [as 别名]
    def test_get_departments_by_semester(self):
        s1, s2 = SemesterFactory.create_batch(2)
        d1, d2, d3 = DepartmentFactory.create_batch(3)
        SemesterDepartmentFactory.create(semester=s1, department=d1)
        SemesterDepartmentFactory.create(semester=s1, department=d2)
        SemesterDepartmentFactory.create(semester=s2, department=d3)

        json = self.json_get(
            'v4:departments',
            get='?semester_id=%d' % s1.id,
            status_code=200)

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


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