Exemplo n.º 1
0
    def test_plugin_processes_content_of_markdown_articles(self):
        with self.app.test_request_context():
            self.app.preprocess_request()

            info = ArticleInfo()
            info.extension = 'md'
            article = Article()
            article.info = info
            article.content = '*stuff*'
            article = self.plugin.on_article_fetch(article)
            self.assertEqual('<p><em>stuff</em></p>', article.content)
Exemplo n.º 2
0
    def test_plugin_skips_non_markdown_articles(self):
        with self.app.test_request_context():
            self.app.preprocess_request()

            info = ArticleInfo()
            info.extension = 'html'
            article = Article()
            article.info = info
            article.content = '*stuff*'
            article = self.plugin.on_article_fetch(article)
            self.assertEqual('*stuff*', article.content)
Exemplo n.º 3
0
    def test_html_summary_attribute_set_correctly(self):
        with self.app.test_request_context():
            self.app.preprocess_request()

            info = ArticleInfo()
            info.extension = 'md'
            article = Article()
            article.info = info
            article.content = '<p>stuff</p><p>blah hello</p><p>dude the</p><p>east market</p>'
            self.app.config['YAWT_EXCERPT_WORDCOUNT'] = 5
            article = self.plugin.on_article_fetch(article)
        self.assertEqual(Markup('<p>stuff</p><p>blah hello</p><p>dude the</p>'), article.info.summary)
Exemplo n.º 4
0
    def test_text_summary_attribute_set_correctly(self):
        with self.app.test_request_context():
            self.app.preprocess_request()

            info = ArticleInfo()
            info.extension = 'md'
            article = Article()
            article.info = info
            article.content = 'stuff blah hello dude the east market'
            self.app.config['YAWT_EXCERPT_WORDCOUNT'] = 5
            article = self.plugin.on_article_fetch(article)
        self.assertEqual('stuff blah hello dude the [...]', article.info.summary)