'Create courses and verify they take certain amount of mongo calls to call get_courses_accessible_to_user.
Also verify that fetch accessible courses list for staff user returns CourseSummary instances.'

@ddt.data((ModuleStoreEnum.Type.split, 3), (ModuleStoreEnum.Type.mongo, 2))
@ddt.unpack
def test_staff_course_listing(self, default_store, mongo_calls):

    GlobalStaff().add_users(self.user)
    self.assertTrue(GlobalStaff().has_user(self.user))
    with self.store.default_store(default_store):
        for num in xrange(TOTAL_COURSES_COUNT):
            course_location = self.store.make_course_key('Org', ('CreatedCourse' + str(num)), 'Run')
            self._create_course_with_access_groups(course_location, self.user, default_store)
    (courses_list_by_staff, __) = get_courses_accessible_to_user(self.request)
    self.assertEqual(len(list(courses_list_by_staff)), TOTAL_COURSES_COUNT)
    self.assertTrue(all((isinstance(course, CourseSummary) for course in courses_list_by_staff)))
    with check_mongo_calls(mongo_calls):
        list(_accessible_courses_summary_iter(self.request))
