Пример #1
0
 def test_database_calls(self, batch_size):
     per_user_queries = 16 * min(batch_size, 6)  # No more than 6 due to offset
     with self.assertNumQueries(3 + 16 * min(batch_size, 6)):
         with check_mongo_calls(1):
             compute_grades_for_course.delay(
                 course_key=six.text_type(self.course.id),
                 batch_size=batch_size,
                 offset=6,
             )
Пример #2
0
 def test_database_calls(self, batch_size):
     per_user_queries = 18 * min(batch_size, 6)  # No more than 6 due to offset
     with self.assertNumQueries(3 + per_user_queries):
         with check_mongo_calls(1):
             compute_grades_for_course.delay(
                 course_key=six.text_type(self.course.id),
                 batch_size=batch_size,
                 offset=6,
             )
Пример #3
0
 def test_behavior(self, batch_size):
     result = compute_grades_for_course.delay(
         course_key=six.text_type(self.course.id),
         batch_size=batch_size,
         offset=4
     )
     self.assertTrue(result.successful)
     self.assertEqual(
         PersistentCourseGrade.objects.filter(course_id=self.course.id).count(),
         min(batch_size, 8)  # No more than 8 due to offset
     )
     self.assertEqual(
         PersistentSubsectionGrade.objects.filter(course_id=self.course.id).count(),
         min(batch_size, 8)  # No more than 8 due to offset
     )
Пример #4
0
 def test_behavior(self, batch_size):
     result = compute_grades_for_course.delay(
         course_key=six.text_type(self.course.id),
         batch_size=batch_size,
         offset=4
     )
     self.assertTrue(result.successful)
     self.assertEqual(
         PersistentCourseGrade.objects.filter(course_id=self.course.id).count(),
         min(batch_size, 8)  # No more than 8 due to offset
     )
     self.assertEqual(
         PersistentSubsectionGrade.objects.filter(course_id=self.course.id).count(),
         min(batch_size, 8)  # No more than 8 due to offset
     )