'Set up library, course and library content XBlock'

def setUp(self):

    super(LibraryContentTestBase, self).setUp()
    self.courseware_page = CoursewarePage(self.browser, self.course_id)
    self.studio_course_outline = StudioCourseOutlinePage(self.browser, self.course_info['org'], self.course_info['number'], self.course_info['run'])
    self.library_fixture = LibraryFixture('test_org', self.unique_id, 'Test    Library    {}'.format(self.unique_id))
    self.populate_library_fixture(self.library_fixture)
    self.library_fixture.install()
    self.library_info = self.library_fixture.library_info
    self.library_key = self.library_fixture.library_key
    self.course_fixture = CourseFixture(self.course_info['org'], self.course_info['number'], self.course_info['run'], self.course_info['display_name'])
    library_content_metadata = {'source_library_id': unicode(self.library_key), 'mode': 'random', 'max_count': 1}
    self.lib_block = XBlockFixtureDesc('library_content', 'Library    Content', metadata=library_content_metadata)
    self.course_fixture.add_children(XBlockFixtureDesc('chapter', SECTION_NAME).add_children(XBlockFixtureDesc('sequential', SUBSECTION_NAME).add_children(XBlockFixtureDesc('vertical', UNIT_NAME).add_children(self.lib_block))))
    self.course_fixture.install()
