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


Python DepartmentFactory.create方法代码示例

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


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

示例1: setUp

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [as 别名]
    def setUp(self):
        self.sem = SemesterFactory.create()
        self.dept1 = DepartmentFactory.create(code='CSCI')
        self.dept2 = DepartmentFactory.create()

        self.course1 = CourseFactory.create(department=self.dept1, name='the course')
        OfferedForFactory.create(course=self.course1, semester=self.sem)

        self.course2 = CourseFactory.create(department=self.dept2)
        OfferedForFactory.create(course=self.course2, semester=self.sem)

        self.course3 = CourseFactory.create(department=self.dept1, name='another course')
        OfferedForFactory.create(course=self.course3, semester=self.sem)
开发者ID:TimeFinders,项目名称:YAExS,代码行数:15,代码来源:querysets.py

示例2: test_get_semester_by_dept

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [as 别名]
    def test_get_semester_by_dept(self):
        d1 = DepartmentFactory.create()
        d2 = DepartmentFactory.create()
        SemesterDepartmentFactory.create(semester=self.s1, department=d1)
        SemesterDepartmentFactory.create(semester=self.s2, department=d2)
        json = self.json_get('v4:semesters', get='?department_id=%d' % d1.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.s1)],
        })
开发者ID:Radzell,项目名称:YACS,代码行数:18,代码来源:tests.py

示例3: setUp

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [as 别名]
    def setUp(self):
        semester = SemesterFactory.create(year=2011, month=1)
        course = CourseFactory.create(pk=2)
        OfferedForFactory.create(semester=semester, course=course)

        section = SectionFactory.create(number=1, course=course, semester=semester)
        sa_section = SectionFactory.create(number=models.Section.STUDY_ABROAD, course=course, semester=semester)
        crn_section = SectionFactory.create(crn=13337, course=course, semester=semester)

        cs_dept = DepartmentFactory.create(code='CSCI')
        SemesterDepartmentFactory.create(semester=semester, department=cs_dept)

        ecse_dept = DepartmentFactory.create(code='ECSE')
        SemesterDepartmentFactory.create(semester=semester, department=ecse_dept)

        self.semester, self.course, self.cs_dept, self.ecse_dept = semester, course, cs_dept, ecse_dept
开发者ID:Radzell,项目名称:YACS,代码行数:18,代码来源:smokes.py

示例4: test_search_department_code

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [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

示例5: test_get_departments_by_code

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [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

示例6: test_get_courses_by_dept_id

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [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

示例7: test_search_department_name

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [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

示例8: setUp

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [as 别名]
 def setUp(self):
     self.dept = DepartmentFactory.create(name='foo', code='CSCI')
开发者ID:Lucky1313,项目名称:YACS,代码行数:4,代码来源:models.py

示例9: setUp

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [as 别名]
 def setUp(self):
     self.s = SemesterFactory.create(year=2012)
     self.d = DepartmentFactory.create()
     SemesterDepartmentFactory(department=self.d, semester=self.s)
开发者ID:Radzell,项目名称:YACS,代码行数:6,代码来源:tests.py

示例10: test_code

# 需要导入模块: from courses.tests.factories import DepartmentFactory [as 别名]
# 或者: from courses.tests.factories.DepartmentFactory import create [as 别名]
 def test_code(self):
     dept = DepartmentFactory.create(code='CSCI')
     course = CourseFactory.create(department=dept, number=1100)
     self.assertEqual('CSCI 1100', course.code)
开发者ID:jeffh,项目名称:YACS,代码行数:6,代码来源:test_models.py


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