Mercurial > wikked
comparison tests/test_page.py @ 357:666a9d0981bb
Quick fixes for the unit tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 20 Sep 2015 14:40:08 -0700 |
parents | be7275021f3a |
children | 6a9e9e4d6b29 |
comparison
equal
deleted
inserted
replaced
356:75bcfb3b37b6 | 357:666a9d0981bb |
---|---|
84 second2 = wiki.getPage('/sub_dir/Second Sibling') | 84 second2 = wiki.getPage('/sub_dir/Second Sibling') |
85 self.assertEqual(['/sub_dir/Second'], second2.links) | 85 self.assertEqual(['/sub_dir/Second'], second2.links) |
86 | 86 |
87 def testGenericUrl(self): | 87 def testGenericUrl(self): |
88 wiki = self._getWikiFromStructure({ | 88 wiki = self._getWikiFromStructure({ |
89 '/foo.txt': "URL: [[blah|url:/blah/boo/raw.txt]]" | 89 '/foo.txt': "URL: [[url:/blah/boo/raw.txt]]" |
90 }) | 90 }) |
91 foo = wiki.getPage('/foo') | 91 foo = wiki.getPage('/foo') |
92 self.assertEqual("URL: <a class=\"wiki-asset\" href=\"/files/blah/boo/raw.txt\">blah</a>", foo.getFormattedText()) | 92 self.assertEqual("URL: /files/blah/boo/raw.txt", foo.getFormattedText()) |
93 | 93 |
94 def testImageUrl(self): | 94 def testImageUrl(self): |
95 wiki = self._getWikiFromStructure({ | 95 wiki = self._getWikiFromStructure({ |
96 '/foo.txt': "URL: [[blah|asset:/blah/boo/image.png]]" | 96 '/foo.txt': "URL: [[blah|asset:/blah/boo/image.png]]" |
97 }) | 97 }) |
98 foo = wiki.getPage('/foo') | 98 foo = wiki.getPage('/foo') |
99 self.assertEqual("URL: <img src=\"/files/blah/boo/image.png\" alt=\"blah\"></img>", foo.getFormattedText()) | 99 self.assertEqual("URL: <img class=\"wiki-asset\" src=\"/files/blah/boo/image.png\" alt=\"blah\"></img>", foo.getFormattedText()) |
100 | 100 |
101 def testUrlTemplateFunctions(self): | 101 def testUrlTemplateFunctions(self): |
102 wiki =self._getWikiFromStructure({ | 102 wiki =self._getWikiFromStructure({ |
103 '/foo.txt': "Here is {{read_url(__page.url, 'FOO')}}!" | 103 '/foo.txt': "Here is {{read_url(__page.url, 'FOO')}}!" |
104 }) | 104 }) |
105 foo = wiki.getPage('/foo') | 105 foo = wiki.getPage('/foo') |
106 self.assertEqual( | 106 self.assertEqual( |
107 'Here is <a class="wiki-link" data-wiki-url="/foo">FOO</a>!', | 107 'Here is <a class="wiki-link" data-wiki-url="/foo" href="/read/foo">FOO</a>!', |
108 foo.text | 108 foo.text |
109 ) | 109 ) |