示例#1
0
 def test_instructor(self):
     self.assertRequestContainsAppx(
         "instructor-reviews",
         self.instructor1_pk,
         {
             **average_and_recent(3, 4),
             "courses": {
                 "CIS-471": {
                     **average_and_recent(3, 4),
                     "full_code": "CIS-471",
                     "code": "CIS-471",
                 }
             },
         },
     )
     self.assertRequestContainsAppx(
         "instructor-reviews",
         self.instructor2_pk,
         {
             **average_and_recent(1.5, 2),
             "courses": {
                 "CIS-471": {
                     **average_and_recent(1.5, 2),
                     "full_code": "CIS-471",
                     "code": "CIS-471",
                 }
             },
         },
     )
示例#2
0
 def test_instructor(self):
     self.assertRequestContainsAppx(
         "instructor-reviews",
         Instructor.objects.get(name=self.instructor_name).pk,
         {
             **average_and_recent(3, 4),
             "courses": {
                 "CIS-471": average_and_recent(3, 4)
             },
         },
     )
示例#3
0
 def test_course_old_code(self):
     self.assertRequestContainsAppx(
         "course-reviews",
         "CIS-371",
         {
             "num_semesters": 3,
             **average_and_recent(3, 4),
             **self.extra_course_data,
             "instructors": {
                 Instructor.objects.get(name=self.instructor_name).pk: {
                     **average_and_recent(3, 4),
                     "latest_semester":
                     TEST_SEMESTER,
                 },
             },
         },
     )
示例#4
0
 def test_department(self):
     self.assertRequestContainsAppx(
         "department-reviews",
         "CIS",
         {
             "courses": {
                 "CIS-471": average_and_recent(2.25, 4)
             },
         },
     )
示例#5
0
 def test_course_old_code(self):
     self.assertRequestContainsAppx(
         "course-reviews",
         "CIS-371",
         {
             "num_semesters": 4,
             **average_and_recent(2.25, 4),
             **self.extra_course_data,
             "instructors": {
                 self.instructor1_pk: {
                     **average_and_recent(3, 4),
                     "latest_semester":
                     TEST_SEMESTER,
                 },
                 self.instructor2_pk: {
                     **average_and_recent(1.5, 2),
                     "latest_semester": "2017A",
                 },
             },
         },
     )
示例#6
0
 def test_course(self):
     self.assertRequestContainsAppx(
         "course-reviews",
         "CIS-471",
         {
             "num_semesters": 3,
             **average_and_recent(2, 2),
             **self.extra_course_data,
             "instructors": {
                 Instructor.objects.get(name=self.instructor_name).pk: {
                     **average_and_recent(2, 2),
                     "latest_semester": "2012A",
                 },
                 Instructor.objects.get(name="Instructor Two").pk: {
                     "average_reviews": {},
                     "recent_reviews": {},
                     "latest_semester": TEST_SEMESTER,
                 },
             },
         },
     )
示例#7
0
 def test_course(self):
     self.assertRequestContainsAppx(
         "course-reviews",
         "ARTH-2220",
         {
             "num_semesters": 1,
             **average_and_recent(4, 4),
             **self.extra_course_data_2220,
             "instructors": {
                 Instructor.objects.get(name=self.instructor_name).pk: {
                     **average_and_recent(4, 4),
                     "latest_semester":
                     TEST_SEMESTER,
                 },
             },
         },
     )
     self.assertRequestContainsAppx(
         "course-reviews",
         "NELC-2055",
         {
             "num_semesters": 1,
             **average_and_recent(3, 3),
             **self.extra_course_data_2055,
             "instructors": {
                 Instructor.objects.get(name=self.instructor_name).pk: {
                     **average_and_recent(3, 3),
                     "latest_semester":
                     TEST_SEMESTER,
                 },
             },
         },
     )
     self.assertRequestContainsAppx(
         "course-reviews",
         "ARTH-222",
         {
             "num_semesters": 1,
             **average_and_recent(2, 2),
             **self.extra_course_data_222,
             "instructors": {
                 Instructor.objects.get(name=self.instructor_name).pk: {
                     **average_and_recent(2, 2),
                     "latest_semester": "2012A",
                 },
             },
         },
     )