def test_get_sections_by_semester(self): sem = SemesterFactory.create() s1, s2 = SectionPeriodFactory.create_batch(2, semester=sem) s3, s4 = SectionPeriodFactory.create_batch(2) json = self.json_get( 'v4:sections', get='?semester_id=%d' % sem.id, status_code=200) self.assertEqual(json, { u"version": 4, u"success": True, u"result": [ self.to_dict(s1), self.to_dict(s2), ] })
def test_get_sections_by_semester(self): sem = SemesterFactory.create() s1, s2 = SectionPeriodFactory.create_batch(2, semester=sem) s3, s4 = SectionPeriodFactory.create_batch(2) json = self.json_get( 'v4:sections', get='?semester_id=%d' % sem.id, status_code=200) self.assertEqual(json, { u"version": 4, u"success": True, u"result": [ self.to_dict(s1), self.to_dict(s2), ] })
def test_get_section_by_id(self): s1, s2 = SectionPeriodFactory.create_batch(2) json = self.json_get('v4:sections', id=s1.id, status_code=200) self.maxDiff = None self.assertEqual(json, { u"version": 4, u"success": True, u"result": self.to_dict(s1), })
def test_get_section_by_id(self): s1, s2 = SectionPeriodFactory.create_batch(2) json = self.json_get('v4:sections', id=s1.id, status_code=200) self.maxDiff = None self.assertEqual(json, { u"version": 4, u"success": True, u"result": self.to_dict(s1), })
def test_get_sections(self): s1, s2, s3, s4 = SectionPeriodFactory.create_batch(4) json = self.json_get('v4:sections', status_code=200) self.assertEqual(json, { u"version": 4, u"success": True, u"result": [ self.to_dict(s1), self.to_dict(s2), self.to_dict(s3), self.to_dict(s4), ] })
def test_get_sections(self): s1, s2, s3, s4 = SectionPeriodFactory.create_batch(4) json = self.json_get('v4:sections', status_code=200) self.assertEqual(json, { u"version": 4, u"success": True, u"result": [ self.to_dict(s1), self.to_dict(s2), self.to_dict(s3), self.to_dict(s4), ] })
def test_get_sections_by_crn(self): s1, s2, s3, s4 = SectionPeriodFactory.create_batch(4) json = self.json_get( 'v4:sections', get='?crn=%d&crn=%d' % (s1.section.crn, s3.section.crn), status_code=200) self.assertEqual(json, { u"version": 4, u"success": True, u"result": [ self.to_dict(s1), self.to_dict(s3), ] })
def test_get_sections_by_crn(self): s1, s2, s3, s4 = SectionPeriodFactory.create_batch(4) json = self.json_get( 'v4:sections', get='?crn=%d&crn=%d' % (s1.section.crn, s3.section.crn), status_code=200) self.assertEqual(json, { u"version": 4, u"success": True, u"result": [ self.to_dict(s1), self.to_dict(s3), ] })
def test_get_sections_by_course(self): c1 = CourseFactory.create() sec1, sec2 = SectionFactory.create_batch(2, course=c1) s1 = SectionPeriodFactory.create(section=sec1) s2 = SectionPeriodFactory.create(section=sec2) s3, s4 = SectionPeriodFactory.create_batch(2) json = self.json_get( 'v4:sections', get='?course_id=%d' % c1.id, status_code=200) self.assertEqual(json, { u"version": 4, u"success": True, u"result": [ self.to_dict(s1), self.to_dict(s2), ] })
def test_get_sections_by_course(self): c1 = CourseFactory.create() sec1, sec2 = SectionFactory.create_batch(2, course=c1) s1 = SectionPeriodFactory.create(section=sec1) s2 = SectionPeriodFactory.create(section=sec2) s3, s4 = SectionPeriodFactory.create_batch(2) json = self.json_get( 'v4:sections', get='?course_id=%d' % c1.id, status_code=200) self.assertEqual(json, { u"version": 4, u"success": True, u"result": [ self.to_dict(s1), self.to_dict(s2), ] })