示例#1
0
 def test_toolbar_template_change_permission(self):
     with SettingsOverride(CMS_PERMISSIONS=True):
         page = create_page('test', 'nav_playground.html', 'en', published=True)
         request = self.get_page_request(page, self.get_nonstaff())
         toolbar = CMSToolbar(request)
         items = toolbar.get_items({})
         self.assertEqual([item for item in items if item.css_class_suffix == 'templates'], [])
示例#2
0
 def test_toolbar_template_change_permission(self):
     with SettingsOverride(CMS_PERMISSIONS=True):
         page = create_page('test', 'nav_playground.html', 'en', published=True)
         request = self.get_page_request(page, self.get_nonstaff())
         toolbar = CMSToolbar(request)
         items = toolbar.get_items({})
         self.assertEqual([item for item in items if item.css_class_suffix == 'templates'], [])
示例#3
0
    def test_toolbar_no_page_superuser(self):
        request = self.request_factory.get('/')
        request.user = self.get_superuser()
        request.current_page = None
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + admin-menu + logout
        self.assertEqual(len(items), 4)

        # check the logo is there
        logo = items[0]
        self.assertTrue(isinstance(logo, Anchor))

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertTrue(isinstance(edit, Switcher))
        self.assertFalse(toolbar.edit_mode)

        # check the admin-menu
        admin = items[2]
        self.assertTrue(isinstance(admin, List))
        self.assertEqual(len(admin.raw_items),
                         1)  # only the link to main admin
        self.assertTrue(isinstance(admin.raw_items[0], ListItem))

        # check the logout button
        logout = items[3]
        self.assertTrue(isinstance(logout, GetButton))
        self.assertEqual(logout.url, '?cms-toolbar-logout')
示例#4
0
    def test_toolbar_no_page_staff(self):
        request = self.get_page_request(None, self.get_staff(), '/')
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + admin-menu + logout
        self.assertEqual(len(items), 4)

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertIsInstance(edit, Switcher)
        self.assertFalse(toolbar.edit_mode)

        # check the admin-menu
        admin = items[2]
        self.assertIsInstance(admin, List)
        self.assertEqual(len(admin.raw_items),
                         1)  # only the link to main admin
        self.assertIsInstance(admin.raw_items[0], ListItem)

        # check the logout button
        logout = items[-1]
        self.assertIsInstance(logout, GetButton)
        self.assertEqual(logout.url, '?cms-toolbar-logout')
示例#5
0
    def test_toolbar_no_page_superuser(self):
        request = self.request_factory.get('/')
        request.user = self.get_superuser()
        request.current_page = None
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + admin-menu + logout
        self.assertEqual(len(items), 4)

        # check the logo is there
        logo = items[0]
        self.assertTrue(isinstance(logo, Anchor))

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertTrue(isinstance(edit, Switcher))
        self.assertFalse(toolbar.edit_mode)

        # check the admin-menu
        admin = items[2]
        self.assertTrue(isinstance(admin, List))
        self.assertEqual(len(admin.raw_items), 1) # only the link to main admin
        self.assertTrue(isinstance(admin.raw_items[0], ListItem))

        # check the logout button
        logout = items[3]
        self.assertTrue(isinstance(logout, GetButton))
        self.assertEqual(logout.url, '?cms-toolbar-logout')
示例#6
0
    def test_toolbar_staff(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.request_factory.get(page.get_absolute_url())
        request.user = self.get_superuser()
        request.current_page = page
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + templates + page-menu + admin-menu + logout
        self.assertEqual(len(items), 6)

        # check templates
        templates = items[2]
        self.assertTrue(isinstance(templates, List))
        self.assertEqual(len(templates.raw_items), len(settings.CMS_TEMPLATES))
        base = reverse('admin:cms_page_change_template', args=(page.pk,))
        for item, template in zip(templates.raw_items, settings.CMS_TEMPLATES):
            self.assertEqual(item.url, '%s?template=%s' % (base, template[0]))

        # normal staff without templates
        request.user = self.get_staff()
        request.session = {}
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + page-menu + admin-menu + logout
        self.assertEqual(len(items), 5)
        # check the logo is there
        logo = items[0]
        self.assertTrue(isinstance(logo, Anchor))

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertTrue(isinstance(edit, Switcher))
        self.assertFalse(toolbar.edit_mode)

        # check page menu
        pagemenu = items[2]
        self.assertTrue(isinstance(pagemenu, List))
        self.assertEqual(len(pagemenu.raw_items), 4)

        overview, addchild, addsibling, delete = pagemenu.raw_items
        self.assertEqual(overview.url, reverse('admin:cms_page_changelist'))
        self.assertEqual(addchild.serialize_url({}, toolbar),
            reverse('admin:cms_page_add') + '?position=last-child&target=%s' % page.pk)
        self.assertEqual(addsibling.serialize_url({}, toolbar),
            reverse('admin:cms_page_add') + '?position=last-child')
        self.assertEqual(delete.serialize_url({}, toolbar),
            reverse('admin:cms_page_delete', args=(page.pk,)))

        # check the admin-menu
        admin = items[3]
        self.assertTrue(isinstance(admin, List))
        self.assertEqual(len(admin.raw_items), 1) # only the link to main admin
        self.assertTrue(isinstance(admin.raw_items[0], ListItem))

        # check the logout button
        logout = items[4]
        self.assertTrue(isinstance(logout, GetButton))
        self.assertEqual(logout.url, '?cms-toolbar-logout')
示例#7
0
    def test_toolbar_no_page_staff(self):
        request = self.get_page_request(None, self.get_staff(), '/')
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + admin-menu + logout
        self.assertEqual(len(items), 4)

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertIsInstance(edit, Switcher)
        self.assertFalse(toolbar.edit_mode)

        # check the admin-menu
        admin = items[2]
        self.assertIsInstance(admin, List)
        self.assertEqual(len(admin.raw_items), 1) # only the link to main admin
        self.assertIsInstance(admin.raw_items[0], ListItem)

        # check the logout button
        logout = items[-1]
        self.assertIsInstance(logout, GetButton)
        self.assertEqual(logout.url, '?cms-toolbar-logout')
示例#8
0
    def test_toolbar_staff(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.get_page_request(page, self.get_superuser())
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + templates + page-menu + admin-menu + logout
        self.assertEqual(len(items), 6)

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertIsInstance(edit, Switcher)
        self.assertFalse(toolbar.edit_mode)

        # check templates
        templates = items[2]
        self.assertIsInstance(templates, List)
        self.assertEqual(len(templates.raw_items),
                         len(get_cms_setting('TEMPLATES')))
        base = reverse('admin:cms_page_change_template', args=(page.pk, ))
        for item, template in zip(templates.raw_items,
                                  get_cms_setting('TEMPLATES')):
            self.assertEqual(item.url, '%s?template=%s' % (base, template[0]))

        # check page menu
        pagemenu = items[3]
        self.assertIsInstance(pagemenu, List)
        self.assertEqual(len(pagemenu.raw_items), 4)

        overview, addchild, addsibling, delete = pagemenu.raw_items
        self.assertEqual(overview.url, reverse('admin:cms_page_changelist'))
        self.assertEqual(
            addchild.serialize_url({}, toolbar),
            reverse('admin:cms_page_add') +
            '?position=last-child&target=%s' % page.pk)
        self.assertEqual(
            addsibling.serialize_url({}, toolbar),
            reverse('admin:cms_page_add') + '?position=last-child')
        self.assertEqual(delete.serialize_url({}, toolbar),
                         reverse('admin:cms_page_delete', args=(page.pk, )))

        # check the admin-menu
        admin = items[4]
        self.assertIsInstance(admin, List)
        self.assertEqual(len(admin.raw_items),
                         3)  # page settings, history and admin
        self.assertIsInstance(admin.raw_items[0], ListItem)
        self.assertIsInstance(admin.raw_items[1], ListItem)
        self.assertIsInstance(admin.raw_items[2], ListItem)

        # check the logout button
        logout = items[-1]
        self.assertIsInstance(logout, GetButton)
        self.assertEqual(logout.url, '?cms-toolbar-logout')
示例#9
0
 def test_toolbar_no_publish_button(self):
     page = create_page('test', 'nav_playground.html', 'en', published=True)
     request = self.get_page_request(page, self.get_staff(), edit=True)
     toolbar = CMSToolbar(request)
     self.assertTrue(page.has_change_permission(request))
     self.assertFalse(page.has_publish_permission(request))
     self.assertTrue(toolbar.edit_mode)
     items = toolbar.get_items({})
     # Logo + edit-mode + templates + page-menu + admin-menu + logout
     self.assertEqual(len(items), 6)
示例#10
0
 def test_toolbar_no_publish_button(self):
     page = create_page('test', 'nav_playground.html', 'en', published=True)
     request = self.get_page_request(page, self.get_staff(), edit=True)
     toolbar = CMSToolbar(request)
     self.assertTrue(page.has_change_permission(request))
     self.assertFalse(page.has_publish_permission(request))
     self.assertTrue(toolbar.edit_mode)
     items = toolbar.get_items({})
     # Logo + edit-mode + templates + page-menu + admin-menu + logout
     self.assertEqual(len(items), 6)
示例#11
0
 def test_toolbar_template_change_permission(self):
     with SettingsOverride(CMS_PERMISSIONS=True):
         page = create_page('test', 'nav_playground.html', 'en', published=True)
         request = self.request_factory.get(page.get_absolute_url())
         request.user = self.get_staff()
         request.current_page = page
         SessionMiddleware().process_request(request)
         request.session = {}
         toolbar = CMSToolbar(request)
         items = toolbar.get_items({})
         self.assertEqual([item for item in items if item.css_class_suffix == 'templates'], [])
示例#12
0
 def test_toolbar_template_change_permission(self):
     with SettingsOverride(CMS_PERMISSIONS=True):
         page = create_page('test', 'nav_playground.html', 'en', published=True)
         request = self.request_factory.get(page.get_absolute_url())
         request.user = self.get_staff()
         request.current_page = page
         SessionMiddleware().process_request(request)
         request.session = {}
         toolbar = CMSToolbar(request)
         items = toolbar.get_items({})
         self.assertEqual([item for item in items if item.css_class_suffix == 'templates'], [])
示例#13
0
    def test_toolbar_no_moderate_button(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.request_factory.get(page.get_absolute_url() + '?edit')
        request.user = self.get_staff()
        request.current_page = page
        toolbar = CMSToolbar(request)

        self.assertTrue(toolbar.edit_mode)

        items = toolbar.get_items({})
        # Logo + edit-mode + templates + page-menu + admin-menu + logout
        self.assertEqual(len(items), 6)
示例#14
0
 def test_toolbar_no_change_button(self):
     page = create_page('test', 'nav_playground.html', 'en', published=True)
     user = self.get_staff()
     user.user_permissions.all().delete()
     request = self.get_page_request(page, user, edit=True)
     toolbar = CMSToolbar(request)
     self.assertFalse(page.has_change_permission(request))
     self.assertFalse(page.has_publish_permission(request))
     self.assertFalse(toolbar.edit_mode)
     items = toolbar.get_items({})
     # Logo + page-menu + admin-menu + logout
     self.assertEqual(len(items), 4)
示例#15
0
    def test_toolbar_no_moderate_button(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.request_factory.get(page.get_absolute_url() + '?edit')
        request.user = self.get_staff()
        request.current_page = page
        toolbar = CMSToolbar(request)

        self.assertTrue(toolbar.edit_mode)

        items = toolbar.get_items({})
        # Logo + edit-mode + templates + page-menu + admin-menu + logout
        self.assertEqual(len(items), 6)
示例#16
0
 def test_toolbar_no_change_button(self):
     page = create_page('test', 'nav_playground.html', 'en', published=True)
     user = self.get_staff()
     user.user_permissions.all().delete()
     request = self.get_page_request(page, user, edit=True)
     toolbar = CMSToolbar(request)
     self.assertFalse(page.has_change_permission(request))
     self.assertFalse(page.has_publish_permission(request))
     self.assertFalse(toolbar.edit_mode)
     items = toolbar.get_items({})
     # Logo + page-menu + admin-menu + logout
     self.assertEqual(len(items), 4)
示例#17
0
    def test_toolbar_staff(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.get_page_request(page, self.get_superuser())
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + templates + page-menu + admin-menu + logout
        self.assertEqual(len(items), 6)

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertIsInstance(edit, Switcher)
        self.assertFalse(toolbar.edit_mode)

        # check templates
        templates = items[2]
        self.assertIsInstance(templates, List)
        self.assertEqual(len(templates.raw_items), len(get_cms_setting('TEMPLATES')))
        base = reverse('admin:cms_page_change_template', args=(page.pk,))
        for item, template in zip(templates.raw_items, get_cms_setting('TEMPLATES')):
            self.assertEqual(item.url, '%s?template=%s' % (base, template[0]))

        # check page menu
        pagemenu = items[3]
        self.assertIsInstance(pagemenu, List)
        self.assertEqual(len(pagemenu.raw_items), 4)

        overview, addchild, addsibling, delete = pagemenu.raw_items
        self.assertEqual(overview.url, reverse('admin:cms_page_changelist'))
        self.assertEqual(addchild.serialize_url({}, toolbar),
            reverse('admin:cms_page_add') + '?position=last-child&target=%s' % page.pk)
        self.assertEqual(addsibling.serialize_url({}, toolbar),
            reverse('admin:cms_page_add') + '?position=last-child')
        self.assertEqual(delete.serialize_url({}, toolbar),
            reverse('admin:cms_page_delete', args=(page.pk,)))

        # check the admin-menu
        admin = items[4]
        self.assertIsInstance(admin, List)
        self.assertEqual(len(admin.raw_items), 3) # page settings, history and admin
        self.assertIsInstance(admin.raw_items[0], ListItem)
        self.assertIsInstance(admin.raw_items[1], ListItem)
        self.assertIsInstance(admin.raw_items[2], ListItem)

        # check the logout button
        logout = items[-1]
        self.assertIsInstance(logout, GetButton)
        self.assertEqual(logout.url, '?cms-toolbar-logout')
示例#18
0
    def test_toolbar_publish_button(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.get_page_request(page, self.get_superuser(), edit=True)
        toolbar = CMSToolbar(request)

        self.assertTrue(toolbar.edit_mode)

        items = toolbar.get_items({})

        # Logo + edit-mode + publish + templates + page-menu + admin-menu + logout
        self.assertEqual(len(items), 7)

        publish = items[2]
        self.assertIsInstance(publish, GetButton)
示例#19
0
    def test_toolbar_publish_button(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.get_page_request(page, self.get_superuser(), edit=True)
        toolbar = CMSToolbar(request)

        self.assertTrue(toolbar.edit_mode)

        items = toolbar.get_items({})

        # Logo + edit-mode + publish + templates + page-menu + admin-menu + logout
        self.assertEqual(len(items), 7)

        publish = items[2]
        self.assertIsInstance(publish, GetButton)
示例#20
0
    def test_toolbar_no_page_anon(self):
        request = self.get_page_request(None, self.get_anon(), '/')
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        self.assertEqual(len(items), 2) # Logo + login

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the login form is there
        login = items[1]
        self.assertIsInstance(login, TemplateHTML)
        self.assertEqual(login.template, 'cms/toolbar/items/login.html')
示例#21
0
    def test_toolbar_no_page_anon(self):
        request = self.get_page_request(None, self.get_anon(), '/')
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        self.assertEqual(len(items), 2)  # Logo + login

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the login form is there
        login = items[1]
        self.assertIsInstance(login, TemplateHTML)
        self.assertEqual(login.template, 'cms/toolbar/items/login.html')
示例#22
0
    def test_toolbar_anon(self):
        page = create_page('test', 'nav_playground.html', 'en')
        request = self.get_page_request(page, self.get_anon())
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        self.assertEqual(len(items), 2) # Logo + login

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the login form is there
        login = items[1]
        self.assertIsInstance(login, TemplateHTML)
        self.assertEqual(login.template, 'cms/toolbar/items/login.html')
示例#23
0
    def test_toolbar_anon(self):
        page = create_page('test', 'nav_playground.html', 'en')
        request = self.get_page_request(page, self.get_anon())
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        self.assertEqual(len(items), 2)  # Logo + login

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the login form is there
        login = items[1]
        self.assertIsInstance(login, TemplateHTML)
        self.assertEqual(login.template, 'cms/toolbar/items/login.html')
示例#24
0
    def test_toolbar_no_page_anon(self):
        request = self.request_factory.get('/')
        request.user = self.get_anon()
        request.current_page = None
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        self.assertEqual(len(items), 2) # Logo + login

        # check the logo is there
        logo = items[0]
        self.assertTrue(isinstance(logo, Anchor))

        # check the login form is there
        login = items[1]
        self.assertTrue(isinstance(login, TemplateHTML))
        self.assertEqual(login.template, 'cms/toolbar/items/login.html')
示例#25
0
 def process_request(self, request):
     """
     If we should show the toolbar for this request, put it on
     request.toolbar. Then call the request_hook on the toolbar.
     """
     if 'edit' in request.GET and not request.session.get('cms_edit', False):
         request.session['cms_edit'] = True
     request.toolbar = CMSToolbar(request)
示例#26
0
 def test_show_toolbar_to_staff(self):
     page = create_page("toolbar-page",
                        "nav_playground.html",
                        "en",
                        published=True)
     request = self.get_page_request(page, self.get_staff(), '/')
     toolbar = CMSToolbar(request)
     self.assertTrue(toolbar.show_toolbar)
示例#27
0
    def test_toolbar_no_page_anon(self):
        request = self.request_factory.get('/')
        request.user = self.get_anon()
        request.current_page = None
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        self.assertEqual(len(items), 2)  # Logo + login

        # check the logo is there
        logo = items[0]
        self.assertTrue(isinstance(logo, Anchor))

        # check the login form is there
        login = items[1]
        self.assertTrue(isinstance(login, TemplateHTML))
        self.assertEqual(login.template, 'cms/toolbar/items/login.html')
示例#28
0
 def test_show_toolbar_without_edit(self):
     page = create_page("toolbar-page",
                        "nav_playground.html",
                        "en",
                        published=True)
     request = self.get_page_request(page, AnonymousUser(), edit=False)
     toolbar = CMSToolbar(request)
     self.assertFalse(toolbar.show_toolbar)
示例#29
0
 def test_show_toolbar_to_staff(self):
     superuser = self.get_superuser()
     page = create_page("toolbar-page", "nav_playground.html", "en",
                        created_by=superuser, published=True)
     request = self.request_factory.get(page.get_absolute_url())
     request.user = self.get_staff()
     request.current_page = page
     toolbar = CMSToolbar(request)
     self.assertTrue(toolbar.show_toolbar)
示例#30
0
 def test_show_toolbar_without_edit(self):
     superuser = self.get_superuser()
     page = create_page("toolbar-page", "nav_playground.html", "en",
                        created_by=superuser, published=True)
     request = self.request_factory.get(page.get_absolute_url())
     request.current_page = page
     request.user = AnonymousUser()
     SessionMiddleware().process_request(request)
     toolbar = CMSToolbar(request)
     self.assertFalse(toolbar.show_toolbar)
示例#31
0
    def test_toolbar_nonstaff(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.get_page_request(page, self.get_nonstaff())
        toolbar = CMSToolbar(request)
        items = toolbar.get_items({})
        # Logo + edit-mode + logout
        self.assertEqual(len(items), 3)

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertIsInstance(edit, Switcher)
        self.assertFalse(toolbar.edit_mode)

        # check the logout button
        logout = items[-1]
        self.assertIsInstance(logout, GetButton)
        self.assertEqual(logout.url, '?cms-toolbar-logout')
示例#32
0
    def test_toolbar_nonstaff(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.get_page_request(page, self.get_nonstaff())
        toolbar = CMSToolbar(request)
        items = toolbar.get_items({})
        # Logo + edit-mode + logout
        self.assertEqual(len(items), 3)

        # check the logo is there
        logo = items[0]
        self.assertIsInstance(logo, Anchor)

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertIsInstance(edit, Switcher)
        self.assertFalse(toolbar.edit_mode)

        # check the logout button
        logout = items[-1]
        self.assertIsInstance(logout, GetButton)
        self.assertEqual(logout.url, '?cms-toolbar-logout')
示例#33
0
    def test_toolbar_staff(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        request = self.request_factory.get(page.get_absolute_url())
        request.user = self.get_superuser()
        request.current_page = page
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + templates + page-menu + admin-menu + logout
        self.assertEqual(len(items), 6)

        # check templates
        templates = items[2]
        self.assertTrue(isinstance(templates, List))
        self.assertEqual(len(templates.raw_items), len(settings.CMS_TEMPLATES))
        base = reverse('admin:cms_page_change_template', args=(page.pk,))
        for item, template in zip(templates.raw_items, settings.CMS_TEMPLATES):
            self.assertEqual(item.url, '%s?template=%s' % (base, template[0]))

        # normal staff without templates
        request.user = self.get_staff()
        request.session = {}
        toolbar = CMSToolbar(request)

        items = toolbar.get_items({})
        # Logo + edit-mode + page-menu + admin-menu + logout
        self.assertEqual(len(items), 5)
        # check the logo is there
        logo = items[0]
        self.assertTrue(isinstance(logo, Anchor))

        # check the edit-mode switcher is there and the switcher is turned off
        edit = items[1]
        self.assertTrue(isinstance(edit, Switcher))
        self.assertFalse(toolbar.edit_mode)

        # check page menu
        pagemenu = items[2]
        self.assertTrue(isinstance(pagemenu, List))
        self.assertEqual(len(pagemenu.raw_items), 4)

        overview, addchild, addsibling, delete = pagemenu.raw_items
        self.assertEqual(overview.url, reverse('admin:cms_page_changelist'))
        self.assertEqual(addchild.serialize_url({}, toolbar),
            reverse('admin:cms_page_add') + '?position=last-child&target=%s' % page.pk)
        self.assertEqual(addsibling.serialize_url({}, toolbar),
            reverse('admin:cms_page_add') + '?position=last-child')
        self.assertEqual(delete.serialize_url({}, toolbar),
            reverse('admin:cms_page_delete', args=(page.pk,)))

        # check the admin-menu
        admin = items[3]
        self.assertTrue(isinstance(admin, List))
        self.assertEqual(len(admin.raw_items), 1) # only the link to main admin
        self.assertTrue(isinstance(admin.raw_items[0], ListItem))

        # check the logout button
        logout = items[4]
        self.assertTrue(isinstance(logout, GetButton))
        self.assertEqual(logout.url, '?cms-toolbar-logout')