'Tests that the Logout menu item includes the user\'s full name, if the
relevant fields were populated in auth.User, else the user\'s username.'

def test_toolbar_logout(self):

    superuser = self.get_superuser()
    if superuser.get_full_name():
        superuser.first_name = ''
        superuser.last_name = ''
        superuser.save()
    page = create_page('home', 'nav_playground.html', 'en', published=True)
    page.publish('en')
    self.get_page_request(page, superuser, '/')
    with self.login_user_context(superuser):
        response = self.client.get((page.get_absolute_url('en') + ('?%s' % get_cms_setting('CMS_TOOLBAR_URL__EDIT_ON'))))
        toolbar = response.context['request'].toolbar
        admin_menu = toolbar.get_or_create_menu(ADMIN_MENU_IDENTIFIER)
        self.assertTrue(admin_menu.find_first(AjaxItem, name=(_(u'Logout    %s') % self.get_username(superuser))))
    superuser.first_name = 'Super'
    superuser.last_name = 'User'
    superuser.save()
    self.get_page_request(page, superuser, '/')
    with self.login_user_context(superuser):
        response = self.client.get((page.get_absolute_url('en') + ('?%s' % get_cms_setting('CMS_TOOLBAR_URL__EDIT_ON'))))
        toolbar = response.context['request'].toolbar
        admin_menu = toolbar.get_or_create_menu(ADMIN_MENU_IDENTIFIER)
        self.assertTrue(admin_menu.find_first(AjaxItem, name=(_(u'Logout    %s') % self.get_username(superuser))))
