test_page.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:fluentcms-pager 作者: django-fluent 项目源码 文件源码
def test_no_arrows(self):
        """
        Pager without arrows
        """
        page1 = self.create_page(slug='page1', position=1, show_arrows=False)
        page2 = self.create_page(slug='page2', position=2, show_arrows=False)
        page3 = self.create_page(slug='page3', position=3, show_arrows=False)

        template = Template('{% load fluent_contents_tags %}{% page_placeholder "content" %}')
        request = RequestFactory().get("/", HTTP_HOST='example.org')

        html1 = template.render(Context({'page': page1, 'request': request}))
        html2 = template.render(Context({'page': page2, 'request': request}))
        html3 = template.render(Context({'page': page3, 'request': request}))

        self.assertEqual(strip_tags(html1).strip(), 'page2')
        self.assertEqual(strip_tags(html2).strip(), 'page1\n    page3')
        self.assertEqual(strip_tags(html3).strip(), 'page2')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号