'Test two courses sharing the same wiki'

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

    self.initdb(default_ms)
    wiki_courses = self.store.get_courses_for_wiki('999')
    self.assertIn(self.course_locations[self.MONGO_COURSEID].course_key.replace(branch=None), wiki_courses)
    mongo_course = self.store.get_course(self.course_locations[self.MONGO_COURSEID].course_key)
    mongo_course.wiki_slug = 'simple'
    self.store.update_item(mongo_course, self.user_id)
    wiki_courses = self.store.get_courses_for_wiki('999')
    self.assertEqual(len(wiki_courses), 0)
    wiki_courses = self.store.get_courses_for_wiki('simple')
    self.assertEqual(len(wiki_courses), 1)
    self.assertIn(self.course_locations[self.MONGO_COURSEID].course_key.replace(branch=None), wiki_courses)
    mongo_course = self.store.get_course(self.course_locations[self.MONGO_COURSEID].course_key)
    mongo_course.wiki_slug = 'MITx.999.2013_Spring'
    self.store.update_item(mongo_course, self.user_id)
    wiki_courses = self.store.get_courses_for_wiki('MITx.999.2013_Spring')
    self.assertEqual(len(wiki_courses), 1)
    self.assertIn(self.course_locations[self.MONGO_COURSEID].course_key.replace(branch=None), wiki_courses)
    wiki_courses = self.store.get_courses_for_wiki('simple')
    self.assertEqual(len(wiki_courses), 0)
    self.assertNotIn(self.course_locations[self.MONGO_COURSEID].course_key.replace(branch=None), wiki_courses)
