'Make sure we cache discovered course mappings'

@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_get_modulestore_cache(self, default_ms):

    self.initdb(default_ms)
    self.store.mappings = {}
    course_key = self.course_locations[self.MONGO_COURSEID].course_key
    with check_exact_number_of_calls(self.store.default_modulestore, 'has_course', 1):
        self.assertEqual(self.store.default_modulestore, self.store._get_modulestore_for_courselike(course_key))
        self.assertIn(course_key, self.store.mappings)
        self.assertEqual(self.store.default_modulestore, self.store._get_modulestore_for_courselike(course_key))
