test_page.py 文件源码

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

项目:fluentcms-pager 作者: django-fluent 项目源码 文件源码
def test_other_titles(self):
        """
        Pager with custom title
        """
        page1 = self.create_page(slug='page1', position=1, previous_title='N/A', next_title='PAGE2')
        page2 = self.create_page(slug='page2', position=2, previous_title='PAGE1', next_title='PAGE3')
        page3 = self.create_page(slug='page3', position=3, previous_title='PAGE2', next_title='N/A')

        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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号