Beispiel #1
0
    def test_get_queryset_root(self, client):
        Page.objects.delete()
        page = PageFactory(depth=1)
        page.save()
        result = self.seolist.get_queryset(client.request())

        assert len(result) == 0
Beispiel #2
0
def page_tree(page):
    from tests.factories.page import PageFactory

    PageFactory(depth=3, path='000100010001', slug='first', numchild=2)
    PageFactory(depth=3, path='000100010002', slug='second')
    PageFactory(depth=3, path='000100010003', slug='third')

    PageFactory(depth=4, path='0001000100010001', slug='first')
    PageFactory(depth=4, path='0001000100010002', slug='second')

    page.numchild = 3
    page.save()

    return page
Beispiel #3
0
    def test_get_queryset(self, client):
        Page.objects.delete()
        page = PageFactory()
        result = self.seolist.get_queryset(client.request())

        assert len(result) == 1
        assert result[0] == page
Beispiel #4
0
    def test_seo_helper(self):
        page = PageFactory()
        result = self.seolist.seo_helper(page)

        assert isinstance(result, SeoHelper)
        assert result.seo_title == page.seo_title
        assert result.search_description == page.search_description
        assert result.page_title == page.title
    def test_search_engine(self):
        page = PageFactory()
        result = self.seolist.search_engine(page)

        assert result == format_html(
            '<strong>{}</strong><p>{}</p>',
            page.seo_title,
            page.search_description
        )
Beispiel #6
0
def multisite(site):
    from tests.factories.page import PageFactory
    from tests.factories.site import SiteFactory

    page_2 = PageFactory(path='00010003', slug='page-2')
    site_2 = SiteFactory(hostname='site_2',
                         is_default_site=False,
                         root_page=page_2)

    page_3 = PageFactory(path='00010004', slug='page-3')
    site_3 = SiteFactory(hostname='site_3',
                         is_default_site=False,
                         root_page=page_3)

    page_4 = PageFactory(path='00010005', slug='page-4')
    site_4 = SiteFactory(hostname='site_4',
                         is_default_site=False,
                         root_page=page_4)

    return [site, site_2, site_3, site_4]
 def setup(self):
     self.user = UserFactory()
     self.admin = UserFactory(is_superuser=True)
     self.page = PageFactory()
Beispiel #8
0
    def test_score(self):
        page = PageFactory()
        result = self.seolist.score(page)

        assert result == format_html(
            '<span style="font-size: 28px;">{}</span>', '😱')
Beispiel #9
0
    def test_admin_display_title(self):
        page = PageFactory()
        result = self.seolist.admin_display_title(page)

        assert result == 'Title'
 def test_page_creation(self, client):
     page = PageFactory(depth=1)
     assert page.title == 'My basic page'