test_page.py 文件源码

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

项目:fluentcms-jumbotron 作者: django-fluent 项目源码 文件源码
def test_default_jumbotron(self):
        """
        Default jumbotron rendering
        """
        page1 = self.create_page(slug='page1', title="Hello", content="<p>test</p>", button1_url='http://example.org/', button1_title="GO")

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

        html = template.render(Context({'page': page1, 'request': request}))
        expected = '''<div class="jumbotron">
  <div class="container">
    <h1>Hello</h1>
    <p>test</p>
    <p><a class="btn btn-primary btn-lg" href="http://example.org/" role="button">GO</a></p>
  </div>
</div>'''
        self.assertEqual(slugify(strip_tags(html)), 'hello-test-go')
        self.assertHTMLEqual(html.strip(), expected)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号