~netlandish/django-wiki

9e1295a040779b039dbfb5e89fe896fbf79a4afa — Benjamin Bach 6 years ago 05cfbc4 + 15c1f83
Merge pull request #842 from atombrella/wiki_macro_tests

Added tests for the wikilinks plugin.
2 files changed, 12 insertions(+), 1 deletions(-)

M src/wiki/plugins/macros/mdx/wikilinks.py
A tests/plugins/macros/test_links.py
M src/wiki/plugins/macros/mdx/wikilinks.py => src/wiki/plugins/macros/mdx/wikilinks.py +0 -1
@@ 1,4 1,3 @@
#!/usr/bin/env python
"""
Extend the shipped Markdown extension 'wikilinks'
"""

A tests/plugins/macros/test_links.py => tests/plugins/macros/test_links.py +12 -0
@@ 0,0 1,12 @@
from tests.base import RequireRootArticleMixin, TestBase
from wiki.core import markdown
from wiki.plugins.macros.mdx.wikilinks import WikiLinkExtension


class WikiLinksTests(RequireRootArticleMixin, TestBase):
    def test_wikilink(self):
        md = markdown.ArticleMarkdown(article=self.root_article, extensions=[WikiLinkExtension()])
        md_text = md.convert('[[Root Article]]')
        self.assertEqual(
            md_text, '<p><a class="wiki_wikilink" href="/Root_Article/">Root Article</a></p>'
        )