Exemplo n.º 1
0
 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),
         ]
     })
Exemplo n.º 2
0
 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),
         ]
     })
Exemplo n.º 3
0
 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),
     })
Exemplo n.º 4
0
 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),
     })
Exemplo n.º 5
0
 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),
         ]
     })
Exemplo n.º 6
0
 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),
         ]
     })
Exemplo n.º 7
0
 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),
         ]
     })
Exemplo n.º 8
0
 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),
         ]
     })
Exemplo n.º 9
0
 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),
         ]
     })
Exemplo n.º 10
0
 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),
         ]
     })