def test_interpage(self): wiki_page = mommy.make_one(WikiPage, title='test') link = LinkTag('test', attrs={'href':'page:test'}) link.parse() assert u'<a href="/wiki/test" class="wiki_link">test</a>' == link.render(), link.render() link = LinkTag('test', attrs={'href':'page:test/test2'}) link.parse() assert u'<a href="/wiki/test/test2" class="wiki_link no_wiki_page">test</a>' == link.render(), link.render()
def test_link_attach(self): wiki_image = mommy.make_one(WikiAttachement, title='test.zip', attach='test.zip') link = LinkTag('test', attrs={'href':'attach:test/test.zip'}) link.parse() assert u'<a href="/media/test.zip" class="wiki_link">test</a>' == link.render(), link.render()
def test_link_image(self): wiki_image = mommy.make_one(WikiImage, title='test.jpeg', image='test.jpeg') link = LinkTag('test', attrs={'href':'image:test/test.jpeg'}) link.parse() assert u'<a href="/media/test.jpeg" class="wiki_link">test</a>' == link.render(), link.render()
def test_generic(self): link = LinkTag('test', attrs={'href':'http://ya.ru'}) link.parse() assert u'<a href="http://ya.ru">test</a>' == link.render()