'Test the get_courses_for_wiki method'

@patch('xmodule.tabs.CourseTab.from_json', side_effect=mock_tab_from_json)
def test_get_courses_for_wiki(self, _from_json):

    for course_number in self.courses:
        course_locations = self.draft_store.get_courses_for_wiki(course_number)
        assert_equals(len(course_locations), 1)
        assert_equals(CourseKey.from_string('/'.join(['edX', course_number, '2012_Fall'])), course_locations[0])
    course_locations = self.draft_store.get_courses_for_wiki('no_such_wiki')
    assert_equals(len(course_locations), 0)
    toy_course = self.draft_store.get_course(CourseKey.from_string('edX/toy/2012_Fall'))
    toy_course.wiki_slug = 'simple'
    self.draft_store.update_item(toy_course, ModuleStoreEnum.UserID.test)
    course_locations = self.draft_store.get_courses_for_wiki('toy')
    assert_equals(len(course_locations), 0)
    course_locations = self.draft_store.get_courses_for_wiki('simple')
    assert_equals(len(course_locations), 2)
    for course_number in ['toy', 'simple']:
        assert_in(CourseKey.from_string('/'.join(['edX', course_number, '2012_Fall'])), course_locations)
    simple_course = self.draft_store.get_course(CourseKey.from_string('edX/simple/2012_Fall'))
    simple_course.wiki_slug = 'edX.simple.2012_Fall'
    self.draft_store.update_item(simple_course, ModuleStoreEnum.UserID.test)
    course_locations = self.draft_store.get_courses_for_wiki('edX.simple.2012_Fall')
    assert_equals(len(course_locations), 1)
    assert_in(CourseKey.from_string('edX/simple/2012_Fall'), course_locations)
