'Test that the library tab is present.'

def test_libraries_on_index(self):

    def _assert_library_tab_present(response):
        "\n                                                Asserts    there's    a    library    tab.\n                                                "
        parsed_html = lxml.html.fromstring(response.content)
        library_tab = parsed_html.find_class('react-library-listing')
        self.assertEqual(len(library_tab), 1)
    lib1 = LibraryFactory.create()
    index_url = '/home/'
    index_response = self.client.get(index_url, {}, HTTP_ACCEPT='text/html')
    _assert_library_tab_present(index_response)
    self.client.logout()
    (non_staff_user, non_staff_userpassword) = self.create_non_staff_user()
    lib2 = LibraryFactory.create(user_id=non_staff_user.id)
    LibraryUserRole(lib2.location.library_key).add_users(non_staff_user)
    self.client.login(username=non_staff_user.username, password=non_staff_userpassword)
    index_response = self.client.get(index_url, {}, HTTP_ACCEPT='text/html')
    _assert_library_tab_present(index_response)
