Esempio n. 1
0
 def setUp(self):
     self.sem = SemesterFactory.create(year=2011, month=1)
     dept1 = DepartmentFactory.create(name='depart1', code='dept1')
     self.sd1 = SemesterDepartmentFactory.create(semester=self.sem,
                                                 department=dept1)
     dept2 = DepartmentFactory.create(name='depart2', code='dept2')
     self.sd2 = SemesterDepartmentFactory.create(semester=self.sem,
                                                 department=dept2)
Esempio n. 2
0
    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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    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
Esempio n. 5
0
    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)],
        })
Esempio n. 6
0
    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)],
        })
Esempio n. 7
0
    def setUp(self):
        self.sem = SemesterFactory.create(year=2011, month=1)
        self.dept = DepartmentFactory.create(code='CSCI')
        SemesterDepartmentFactory.create(department=self.dept, semester=self.sem)

        self.course = CourseFactory.create(number=2222, department=self.dept)
        OfferedForFactory.create(course=self.course, semester=self.sem)

        self.section = SectionFactory.create(course=self.course, semester=self.sem)
        SectionPeriodFactory.create(section=self.section)
Esempio n. 8
0
 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)],
     })
Esempio n. 9
0
    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)]
        })
Esempio n. 10
0
    def setUp(self):
        self.sem = SemesterFactory.create(year=2011, month=1)
        self.dept = DepartmentFactory.create(code='CSCI')
        SemesterDepartmentFactory.create(department=self.dept,
                                         semester=self.sem)

        self.course = CourseFactory.create(number=2222, department=self.dept)
        OfferedForFactory.create(course=self.course, semester=self.sem)

        self.section = SectionFactory.create(course=self.course,
                                             semester=self.sem)
        SectionPeriodFactory.create(section=self.section)
Esempio n. 11
0
 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)],
     })
Esempio n. 12
0
    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)]
        })
Esempio n. 13
0
 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),
         ]
     })
Esempio n. 14
0
    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
Esempio n. 15
0
 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),
         ]
     })
Esempio n. 16
0
 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),
         ],
     })
Esempio n. 17
0
 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),
         ],
     })
Esempio n. 18
0
 def setUp(self):
     self.dept = DepartmentFactory.create(name='foo', code='CSCI')
Esempio n. 19
0
 def setUp(self):
     self.sem = SemesterFactory.create(year=2011, month=1)
     dept1 = DepartmentFactory.create(name='depart1', code='dept1')
     self.sd1 = SemesterDepartmentFactory.create(semester=self.sem, department=dept1)
     dept2 = DepartmentFactory.create(name='depart2', code='dept2')
     self.sd2 = SemesterDepartmentFactory.create(semester=self.sem, department=dept2)
Esempio n. 20
0
 def setUp(self):
     self.dept = DepartmentFactory.create(name='foo', code='CSCI')
Esempio n. 21
0
 def setUp(self):
     self.s = SemesterFactory.create(year=2012)
     self.d = DepartmentFactory.create()
     SemesterDepartmentFactory(department=self.d, semester=self.s)
Esempio n. 22
0
 def test_code(self):
     dept = DepartmentFactory.create(code='CSCI')
     course = CourseFactory.create(department=dept, number=1100)
     self.assertEqual('CSCI 1100', course.code)
Esempio n. 23
0
 def setUp(self):
     self.s = SemesterFactory.create(year=2012)
     self.d = DepartmentFactory.create()
     SemesterDepartmentFactory(department=self.d, semester=self.s)
Esempio n. 24
0
 def test_code(self):
     dept = DepartmentFactory.create(code='CSCI')
     course = CourseFactory.create(department=dept, number=1100)
     self.assertEqual('CSCI 1100', course.code)