'Test that a constant number of mongo calls are made regardless of how
many grade-related blocks are in the course.'

@ddt.data((ModuleStoreEnum.Type.split, 3), (ModuleStoreEnum.Type.mongo, 2))
@ddt.unpack
def test_modulestore_performance(self, store_type, expected_mongo_queries):

    course = [{u'org': u'GradesTestOrg', u'course': u'GB101', u'run': u'cannonball', u'metadata': {u'format': u'homework'}, u'#type': u'course', u'#ref': u'course', u'#children': []}]
    for problem_number in xrange(random.randrange(10, 20)):
        course[0][u'#children'].append({u'metadata': {u'graded': True, u'weight': 1, u'due': datetime.datetime(2099, 3, 15, 12, 30, 0, tzinfo=pytz.utc)}, u'#type': u'problem', u'#ref': u'problem_{}'.format(problem_number), u'data': u'\n                                                                                                <problem>\n                                                                                                                <numericalresponse    answer="{number}">\n                                                                                                                                <textline    label="1*{number}"    />\n                                                                                                                </numericalresponse>\n                                                                                                </problem>'.format(number=problem_number)})
    with self.store.default_store(store_type):
        blocks = self.build_course(course)
    clear_course_from_cache(blocks[u'course'].id)
    with check_mongo_calls(expected_mongo_queries):
        get_course_blocks(self.student, blocks[u'course'].location, self.transformers)
