~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to mainpage/utest/test_wl_markdown.py

  • Committer: Holger Rapp
  • Date: 2010-01-01 21:35:23 UTC
  • mto: (173.3.2 widelands)
  • mto: This revision was merged to the branch mainline in revision 176.
  • Revision ID: rapp@mrt.uka.de-20100101213523-53rcapbemm69ep6u
Made the site compatible to django 1.1 and all the various packages

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
# Last Modified: $Date$
10
10
#
11
11
 
12
 
# Since we want to include something from one path up,
 
12
# Since we want to include something from one path up, 
13
13
# we append the parent path to sys.path
14
14
import sys; sys.path.append("..")
15
15
 
42
42
        input = u"Na Du HalloWelt, Du?"
43
43
        wanted = u"""<p>Na Du <a href="/wiki/HalloWelt">HalloWelt</a>, Du?</p>"""
44
44
        self._check(input,wanted)
45
 
 
 
45
    
46
46
    def test_wikiwords_avoid__except_correct_result(self):
47
47
        input = u"Hi !NotAWikiWord Moretext"
48
48
        wanted = u"""<p>Hi NotAWikiWord Moretext</p>"""
67
67
        input =  u"""<a href="http://www.ccc.de"><img src="/blub" /></a>"""
68
68
        wanted = u"""<p><a href="http://www.ccc.de"><img src="/blub" /></a></p>"""
69
69
        self._check(input,wanted)
70
 
 
 
70
    
71
71
    # Existing links
72
72
    def test_existing_link_html(self):
73
73
        input = u"""<a href="/wiki/MainPage">this page</a>"""
110
110
        input = u"""<a href="/wiki/MissingPage/edit/">this page</a>"""
111
111
        wanted = u"""<p><a href="/wiki/MissingPage/edit/" class="missing">this page</a></p>"""
112
112
        self._check(input,wanted)
113
 
 
 
113
    
114
114
    # Check smileys
115
115
    def test_smiley_angel(self):
116
116
        input = """O:-)"""
201
201
        input = u"""[list](/wiki/list)"""
202
202
        wanted = u"""<p><a href="/wiki/list">list</a></p>"""
203
203
        self._check(input,wanted)
204
 
 
 
204
    
205
205
    # Special problem with emphasis
206
206
    def test_markdown_emphasis_problem(self):
207
207
        input = u"""*This is bold*  _This too_\n\n"""
208
208
        wanted = u"""<p><em>This is bold</em> <em>This too</em></p>"""
209
209
        self._check(input,wanted)
210
 
 
 
210
    
211
211
    # Another markdown problem with alt tag escaping
212
212
    def test_markdown_alt_problem(self):
213
213
        # {{{ Test strings
215
215
        wanted = u'<p><img alt="img_thisisNOTitalicplease_name.png" src="/wlmedia/blah.png" /></p>'
216
216
        # }}}
217
217
        self._check(input,wanted)
218
 
 
 
218
    
219
219
    def test_emptystring_problem(self):
220
220
        # {{{ Test strings
221
221
        input = u''
231
231
------- | --------
232
232
Value 1 | Value 2
233
233
Value 3 | Value 4
234
 
"""
 
234
"""     
235
235
        wanted = u"""<table>
236
236
<thead>
237
237
<tr>
253
253
        # }}}
254
254
        self._check(input,wanted)
255
255
    def test_svnrevision_replacement( self ):
256
 
        input = u"- Fixed this bug (bzr:r3222)"
257
 
        wanted = u"""<ul>\n<li>Fixed this bug (<a href="http://bazaar.launchpad.net/%7Ewidelands-dev/widelands/trunk/revision/3222" class="external">r3222</a>)</li>\n</ul>"""
 
256
        input = u"- Fixed this bug (svn:r3222)"
 
257
        wanted = u"""<ul>\n<li>Fixed this bug (<a href="http://widelands.svn.sourceforge.net/viewvc/widelands?view=rev&amp;revision=3222" class="external">r3222</a>)</li>\n</ul>"""
258
258
        self._check(input,wanted)
259
259
    def test_svnrevision_multiple_replacement( self ):
260
 
        input = u"- Fixed this bug (bzr:r3222, bzr:r3424)"
261
 
        wanted = u"""<ul>\n<li>Fixed this bug (<a href="http://bazaar.launchpad.net/%7Ewidelands-dev/widelands/trunk/revision/3222" class="external">r3222</a>, <a href="http://bazaar.launchpad.net/%7Ewidelands-dev/widelands/trunk/revision/3424" class="external">r3424</a>)</li>\n</ul>"""
 
260
        input = u"- Fixed this bug (svn:r3222, svn:r3424)"
 
261
        wanted = u"""<ul>\n<li>Fixed this bug (<a href="http://widelands.svn.sourceforge.net/viewvc/widelands?view=rev&amp;revision=3222" class="external">r3222</a>, <a href="http://widelands.svn.sourceforge.net/viewvc/widelands?view=rev&amp;revision=3424" class="external">r3424</a>)</li>\n</ul>"""
262
262
        self._check(input,wanted)
263
 
 
 
263
        
264
264
 
265
265
if __name__ == '__main__':
266
266
    unittest.main()