Back to index

moin  1.9.0~rc2
Public Member Functions
test_conv160_wiki.TestWikiConversion Class Reference

List of all members.

Public Member Functions

def test_absolute
def test_sisterpage
def test_subpage
def test_parser
def test_pre

Detailed Description

test the wiki markup conversion 1.5.8 -> 1.6.0 

Definition at line 30 of file test_conv160_wiki.py.


Member Function Documentation

Definition at line 32 of file test_conv160_wiki.py.

00032 
00033     def test_absolute(self):
00034         request = self.request
00035         pagename = 'TestPage'
00036         rename_some_page = {
00037                 ('PAGE', 'some_page'): 'some page',
00038         }
00039         rename_some_file = {
00040                 ('FILE', pagename, 'with_underscore'): 'without underscore',
00041                 ('FILE', pagename, 'with blank'): 'without_blank',
00042         }
00043 
00044         tests = [
00045             # FAILING tests:
00046             # does not work in 1.5.8, no need to convert:
00047             #('[:MeatBall:CleanLinking meatball-wiki: clean linking]', {}, '[:MeatBall:CleanLinking meatball-wiki: clean linking]'),
00048 
00049             # does not work in 1.5.8, no need to convert:
00050             #('[attachment:some_page.txt attachment:some_page.png]', rename_some_page, '[[attachment:some_page.txt|{{attachment:some_page.png}}]]'),
00051 
00052             # "nothing changed" checks (except markup)
00053             ('', {}, ''),
00054             ('CamelCase', {}, 'CamelCase'),
00055             ('MoinMaster:CamelCase', {}, 'MoinMaster:CamelCase'),
00056             ('[wiki:LinuxWiki: LinuxWiki.de]', {}, '[[LinuxWiki:|LinuxWiki.de]]'),
00057             # does not work in 1.5.8, no need to convert:
00058             #('[wiki:MacroMarket/EmbedObject EO]', {}, '["MacroMarket/EmbedObject" EO]'),
00059             ('[wiki:MoinMoin/FrontPage]', {}, 'MoinMoin:FrontPage'),
00060             ('[wiki:/OtherPage]', rename_some_page, '[[/OtherPage]]'),
00061             ('[wiki:/OtherPage other page]', rename_some_page, '[[/OtherPage|other page]]'),
00062             ('some_text', {}, 'some_text'),
00063             ('["some_text"]', {}, '[[some_text]]'),
00064             ('some_page', rename_some_page, 'some_page'), # not a link
00065             ('{{{["some_page"]}}}', rename_some_page, '{{{["some_page"]}}}'), # not a link
00066             ('`["some_page"]`', rename_some_page, '`["some_page"]`'), # not a link
00067             ('["OtherPage/some_page"]', rename_some_page, '[[OtherPage/some_page]]'), # different link
00068             ('MoinMaster:some_page', rename_some_page, 'MoinMaster:some_page'), # external link
00069             ('http://some_server/some_page', rename_some_page, 'http://some_server/some_page'), # external link
00070             ('[http://some_server/some_page]', rename_some_page, '[[http://some_server/some_page]]'), # external link
00071             ('[#some_page]', rename_some_page, '[[#some_page]]'), # link to anchor that has same name
00072             ('[attachment:some_page.png]', rename_some_page, '[[attachment:some_page.png]]'), # att, not page
00073             ('[attachment:some_page.png test picture]', rename_some_page, '[[attachment:some_page.png|test picture]]'), # att, not page
00074             # url unquote stuff (%20 was popular for space)
00075             ('attachment:My%20Attachment.jpg', {}, '{{attachment:My Attachment.jpg}}'), # embed!
00076             ('[attachment:My%20Attachment.jpg]', {}, '[[attachment:My Attachment.jpg]]'), # link!
00077             ('[attachment:My%20Attachment.jpg it works]', {}, '[[attachment:My Attachment.jpg|it works]]'),
00078 
00079             # page rename changes result
00080             ('["some_page"]', rename_some_page, '[[some page]]'),
00081             ('[:some_page]', rename_some_page, '[[some page]]'),
00082             ('[:some_page:]', rename_some_page, '[[some page]]'),
00083             ('[:some_page:some text]', rename_some_page, '[[some page|some text]]'),
00084             ('Self:some_page', rename_some_page, '[[some page]]'),
00085             ('wiki:Self:some_page', rename_some_page, '[[some page]]'),
00086             ('[wiki:Self:some_page some text]', rename_some_page, '[[some page|some text]]'),
00087             ('wiki:Self:some_page#some_anchor', rename_some_page, '[[some page#some_anchor]]'),
00088 
00089             # other markup changes we do
00090             ('[:other page]', {}, '[[other page]]'),
00091             ('[:other page:]', {}, '[[other page]]'),
00092             ('[:other page:other text]', {}, '[[other page|other text]]'),
00093             ('Self:CamelCase', {}, 'CamelCase'),
00094             ('[wiki:WikiPedia:Lynx_%28web_browser%29 Lynx]', {}, '[[WikiPedia:Lynx_(web_browser)|Lynx]]'),
00095             ('[:Something:Something]', {}, '[[Something]]'), # optimize markup
00096 
00097             # "nothing changed" checks
00098             ('attachment:OtherPage/with_underscore', rename_some_file, '[[attachment:OtherPage/with_underscore]]'),
00099 
00100             # file rename changes result
00101             ('attachment:with_underscore', rename_some_file, '[[attachment:without underscore]]'),
00102             ('attachment:TestPage/with_underscore', rename_some_file, '[[attachment:without underscore]]'), # remove superfluous pagename
00103 
00104             # attachment syntax: kill %20
00105             ('attachment:with%20blank', rename_some_file, '[[attachment:without_blank]]'), # plus rename
00106             ('attachment:keep%20blank', rename_some_file, '[[attachment:keep blank]]'), # no rename
00107             ('attachment:TestPage/keep%20blank', rename_some_file, '[[attachment:keep blank]]'), # remove superfluous pagename
00108             ('attachment:OtherPage/keep%20blank', rename_some_file, '[[attachment:OtherPage/keep blank]]'),
00109 
00110             # embed images
00111             ('http://server/image.png', {}, '{{http://server/image.png}}'),
00112             ('attachment:image.gif', {}, '{{attachment:image.gif}}'),
00113             ('inline:image.jpg', {}, '{{attachment:image.jpg}}'), # inline is now implied by {{...}}
00114             ('drawing:image', {}, '{{drawing:image}}'),
00115 
00116             # macros
00117             ('[[BR]]', {}, '<<BR>>'),
00118             ('[[FullSearch(wtf)]]', {}, '<<FullSearch(wtf)>>'),
00119             (u'[[ImageLink(töst.png)]]', {}, u'[[attachment:töst.png|{{attachment:töst.png}}]]'),
00120             ('[[ImageLink(test.png,OtherPage)]]', {}, '[[OtherPage|{{attachment:test.png}}]]'),
00121             ('[[ImageLink(test.png,OtherPage,width=123,height=456)]]', {}, '[[OtherPage|{{attachment:test.png||width=123, height=456}}]]'),
00122             ('[[ImageLink(test.png,OtherPage,width=123,height=456,alt=alttext)]]', {}, '[[OtherPage|{{attachment:test.png|alttext|width=123, height=456}}]]'),
00123             ('[[ImageLink(test.png,OtherPage,width=123,height=456,alt=alt text with blanks)]]', {}, '[[OtherPage|{{attachment:test.png|alt text with blanks|width=123, height=456}}]]'),
00124             ('[[ImageLink(http://server/test.png,OtherPage,width=123,height=456)]]', {}, '[[OtherPage|{{http://server/test.png||width=123, height=456}}]]'),
00125             ('[[ImageLink(http://server/test.png,http://server/,width=123)]]', {}, '[[http://server/|{{http://server/test.png||width=123}}]]'),
00126             ('[[ImageLink(test.png,attachment:test.png)]]', {}, '[[attachment:test.png|{{attachment:test.png}}]]'),
00127             ('[[ImageLink(test.png,inline:test.py)]]', {}, '[[attachment:test.py|{{attachment:test.png}}]]'),
00128 
00129         ]
00130         for data, renames, expected in tests:
00131             assert convert_wiki(request, pagename, data, renames) == expected

Here is the call graph for this function:

Definition at line 165 of file test_conv160_wiki.py.

00165 
00166     def test_parser(self):
00167         #py.test.skip("not wanted right now")
00168         markup_15 = u"""\
00169 {{{#!html
00170 ...
00171 }}}
00172 
00173 """
00174         expected_markup_160 = u"""\
00175 {{{#!html
00176 ...
00177 }}}
00178 
00179 """
00180         markup_160 = convert_wiki(self.request, u'TestPage', markup_15, {})
00181         #print markup_15 ; print "---" ; print markup_160
00182         markup_160 = markup_160.replace('\r\n', '\n')
00183         assert markup_160 == expected_markup_160
00184 

Here is the call graph for this function:

Definition at line 185 of file test_conv160_wiki.py.

00185 
00186     def test_pre(self):
00187         #py.test.skip("not wanted right now")
00188         markup_15 = u"""\
00189 {{{
00190 ...
00191 }}}
00192 
00193 """
00194         expected_markup_160 = u"""\
00195 {{{
00196 ...
00197 }}}
00198 
00199 """
00200         markup_160 = convert_wiki(self.request, u'TestPage', markup_15, {})
00201         #print markup_15 ; print "---" ; print markup_160
00202         markup_160 = markup_160.replace('\r\n', '\n')
00203         assert markup_160 == expected_markup_160
00204 

Here is the call graph for this function:

Definition at line 132 of file test_conv160_wiki.py.

00132 
00133     def test_sisterpage(self):
00134         request = self.request
00135         top_page = 'toppage'
00136         pagename = '%s/subpage' % top_page
00137         rename_some_page = {
00138                 ('PAGE', '%s/sister' % top_page): '%s/renamed_sister' % top_page,
00139         }
00140         tests = [
00141             # "nothing changed" checks
00142             ('["../sister_norename"]', rename_some_page, '[[../sister_norename]]'),
00143 
00144             # renames
00145             ('["../sister"]', rename_some_page, '[[../renamed_sister]]'),
00146         ]
00147         for data, renames, expected in tests:
00148             assert convert_wiki(request, pagename, data, renames) == expected

Here is the call graph for this function:

Definition at line 149 of file test_conv160_wiki.py.

00149 
00150     def test_subpage(self):
00151         request = self.request
00152         pagename = 'toppage'
00153         rename_some_page = {
00154                 ('PAGE', '%s/subpage' % pagename): '%s/renamed_subpage' % pagename,
00155         }
00156         tests = [
00157             # "nothing changed" checks
00158             ('["/subpage_norename"]', rename_some_page, '[[/subpage_norename]]'),
00159 
00160             # renames
00161             ('["/subpage"]', rename_some_page, '[[/renamed_subpage]]'),
00162         ]
00163         for data, renames, expected in tests:
00164             assert convert_wiki(request, pagename, data, renames) == expected

Here is the call graph for this function:


The documentation for this class was generated from the following file: