Пример #1
0
 def test_page_summary_multiple_sites(self):
     Site.objects.create(hostname='example.com',
                         root_page=Page.objects.get(pk=1))
     request = self.get_request()
     link = '<a href="{}">'.format(reverse('wagtailadmin_explore_root'))
     page_summary = PagesSummaryItem(request)
     self.assertIn(link, page_summary.render())
Пример #2
0
 def test_page_summary_single_site(self):
     request = self.get_request()
     root_page = request.site.root_page
     link = '<a href="{}">'.format(
         reverse('wagtailadmin_explore', args=[root_page.pk]))
     page_summary = PagesSummaryItem(request)
     self.assertIn(link, page_summary.render())
Пример #3
0
def add_pages_summary_item(request, items):
    items.insert(0, PagesSummaryItem(request))
Пример #4
0
 def test_page_summary_zero_sites(self):
     Site.objects.all().delete()
     request = self.get_request()
     link = '<a href="{}">'.format(reverse('wagtailadmin_explore_root'))
     page_summary = PagesSummaryItem(request)
     self.assertIn(link, page_summary.render())
Пример #5
0
 def test_user_with_no_page_permissions_is_not_shown_panel(self):
     self.user.is_superuser = False
     self.user.save()
     self.assertFalse(PagesSummaryItem(self.request).is_shown())
Пример #6
0
 def test_user_with_page_permissions_is_shown_panel(self):
     self.assertTrue(PagesSummaryItem(self.request).is_shown())
Пример #7
0
 def assertSummaryContains(self, content):
     summary = PagesSummaryItem(self.request).render_html()
     self.assertIn(content, summary)