Example #1
0
def _article(fullname, tags, content):
    info = ArticleInfo()
    info.fullname = fullname
    info.tags = tags
    article = Article()
    article.info = info
    article.content = content
    return article
Example #2
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)
Example #3
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)
Example #4
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)
Example #5
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)