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


Python factories.CourseFactory类代码示例

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


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

示例1: setUp

 def setUp(self):
     next_week = now() + timedelta(days=7)
     self.api_url = reverse('fun-courses-api:courses-list')
     self.active_1 = CourseFactory(
         title='active course 1',
         show_in_catalog=True,
         is_active=True,
         end_date=next_week,
     )
     self.active_2 = CourseFactory(
         title='active course 2',
         show_in_catalog=True,
         is_active=True,
         end_date=next_week,
     )
     self.not_active = CourseFactory(
         title='course not active',
         show_in_catalog=True,
         is_active=False,
         end_date=next_week,
     )
     self.not_in_catalog = CourseFactory(
         title='course not in catalog',
         show_in_catalog=False,
         is_active=True,
         end_date=next_week,
     )
     self.user = UserFactory(username='user', password='password')  # user with profile
开发者ID:openfun,项目名称:fun-apps,代码行数:28,代码来源:test_course_api.py

示例2: test_search_name

 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,代码行数:11,代码来源:tests.py

示例3: test_get_courses_by_number

 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,代码行数:12,代码来源:tests.py

示例4: test_search_department_code

 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,代码行数:12,代码来源:tests.py

示例5: setUp

    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,代码行数:13,代码来源:querysets.py

示例6: test_search_instructor

 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,代码行数:14,代码来源:tests.py

示例7: test_get_courses_by_dept_id

 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,代码行数:14,代码来源:tests.py

示例8: test_search_department_name

 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,代码行数:15,代码来源:tests.py

示例9: test_crns

    def test_crns(self):
        course = CourseFactory.create()
        section1 = SectionFactory.create(crn=123, course=course)
        section2 = SectionFactory.create(crn=124, course=course)
        SectionPeriodFactory.create(section=section1)
        SectionPeriodFactory.create(section=section2)

        self.assertEqual([123, 124], list(course.crns))
开发者ID:Lucky1313,项目名称:YACS,代码行数:8,代码来源:models.py

示例10: setUp

    def setUp(self):
        super(SearchTest, self).setUp()
        course = CourseFactory.create(department=self.cs_dept, number=4230, name='Intro to Computing')
        OfferedForFactory.create(course=course, semester=self.semester)

        course2 = CourseFactory.create(department=self.cs_dept, number=4231, name='Skynet 101')
        OfferedForFactory.create(course=course2, semester=self.semester)

        # another department
        course3 = CourseFactory.create(department=self.ecse_dept, number=4230, name='Imaginary Power')
        OfferedForFactory.create(course=course3, semester=self.semester)

        section = SectionFactory.create(course=course, semester=self.semester)
        period = PeriodFactory.create(start=datetime.time(hour=12), end=datetime.time(hour=13), days_of_week_flag=1)
        SectionPeriodFactory.create(section=section, period=period, instructor='Moorthy', semester=self.semester)

        self.course1, self.course2, self.course3 = course, course2, course3
开发者ID:Radzell,项目名称:YACS,代码行数:17,代码来源:smokes.py

示例11: test_get_course_by_id

 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,代码行数:8,代码来源:tests.py

示例12: test_fetch_should_not_exclude_comm_intense

 def test_fetch_should_not_exclude_comm_intense(self):
     c1 = CourseFactory.create(is_comm_intense=True)
     json = self.json_get('v4:courses', id=c1.id, status_code=200)
     self.maxDiff = None
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": self.to_dict(c1),
     })
开发者ID:Radzell,项目名称:YACS,代码行数:9,代码来源:tests.py

示例13: test_full_crns

    def test_full_crns(self):
        course = CourseFactory.create()
        section1 = SectionFactory.create(
            crn=123, course=course, seats_total=1, seats_taken=0)
        section2 = SectionFactory.create(
            crn=124, course=course, seats_total=1, seats_taken=5)
        SectionPeriodFactory.create(section=section1)
        SectionPeriodFactory.create(section=section2)

        self.assertEqual([124], list(course.full_crns))
开发者ID:Lucky1313,项目名称:YACS,代码行数:10,代码来源:models.py

示例14: test_kinds

    def test_kinds(self):
        course = CourseFactory.create()
        section1 = SectionFactory.create(crn=123, course=course)
        section2 = SectionFactory.create(crn=124, course=course, seats_total=1)
        SectionPeriodFactory.create(section=section1, kind='foo')
        SectionPeriodFactory.create(section=section1, kind='foobar')
        SectionPeriodFactory.create(section=section1, kind='fizzbuzz')
        SectionPeriodFactory.create(section=section2, kind='fizz')

        self.assertEqual(set(['foo', 'foobar', 'fizzbuzz', 'fizz']), set(course.kinds))
开发者ID:Lucky1313,项目名称:YACS,代码行数:10,代码来源:models.py

示例15: test_get_departments_by_courses

    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,代码行数:19,代码来源:tests.py


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