'Test number of queries by cohorts.get_cohort() with and without caching.'

@ddt.data((True, 2), (False, 6))
@ddt.unpack
def test_get_cohort_sql_queries(self, use_cached, num_sql_queries):

    course = modulestore().get_course(self.toy_course_key)
    config_course_cohorts(course, is_cohorted=True)
    user = UserFactory(username='test', email='a@b.com')
    CohortFactory.create(course_id=course.id, name='TestCohort', users=[user])
    with self.assertNumQueries(num_sql_queries):
        for __ in range(3):
            cohorts.get_cohort(user, course.id, use_cached=use_cached)
