Back to index

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

List of all members.

Public Member Functions

def test_absolute
def test_sisterpage
def test_subpage
def test_full_page
def test_parser
def test_pre

Detailed Description

test the wiki markup conversion 1.6.0a -> 1.6.0 

Definition at line 29 of file test_conv160a_wiki.py.


Member Function Documentation

Definition at line 31 of file test_conv160a_wiki.py.

00031 
00032     def test_absolute(self):
00033         request = self.request
00034         pagename = 'TestPage'
00035         rename_some_page = {
00036                 ('PAGE', 'some_page'): 'some page',
00037         }
00038         rename_some_file = {
00039                 ('FILE', pagename, 'with_underscore'): 'without underscore',
00040                 ('FILE', pagename, 'with blank'): 'without_blank',
00041         }
00042 
00043         tests = [
00044             # attachment links
00045             ("attachment:filename.ext", {}, "[[attachment:filename.ext]]"),
00046             ("[attachment:'Filename.ext' Aliasname]", {}, "[[attachment:Filename.ext|Aliasname]]"),
00047             ("[attachment:'Pagename/Filename.ext' Aliasname]", {}, "[[attachment:Pagename/Filename.ext|Aliasname]]"),
00048             ("[attachment:'Pagename/Subpage/Filename.ext' Aliasname]", {}, "[[attachment:Pagename/Subpage/Filename.ext|Aliasname]]"),
00049             ('[attachment:"Pagename/Subpage/File Name.ext" Aliasname]', {}, "[[attachment:Pagename/Subpage/File Name.ext|Aliasname]]"),
00050             ('[inline:text.txt]', {}, '{{attachment:text.txt}}'), # inline is now implied by {{...}}
00051             ('[inline:image.jpg]', {}, '{{attachment:image.jpg}}'), # inline is now implied by {{...}}
00052             ('[drawing:image]', {}, '{{drawing:image}}'),
00053             ('[inline:text.txt foo]', {}, '{{attachment:text.txt|foo}}'), # inline is now implied by {{...}}
00054             ('[inline:image.jpg foo]', {}, '{{attachment:image.jpg|foo}}'), # inline is now implied by {{...}}
00055             ('[drawing:image foo]', {}, '{{drawing:image|foo}}'),
00056 
00057             # "nothing changed" checks (except markup)
00058             ('', {}, ''),
00059             ('CamelCase', {}, 'CamelCase'),
00060             ('["/Subpage"]', {}, "[[/Subpage]]"),
00061             ('["Pagename/Subpage"]', {}, "[[Pagename/Subpage]]"),
00062             ("['Pagename/Subpage' Aliasname]", {}, "[[Pagename/Subpage|Aliasname]]"),
00063             ('["some page" somepage]', {}, '[[some page|somepage]]'),
00064             ("['some page' somepage]", {}, '[[some page|somepage]]'),
00065 
00066             ('Doesnotexist:CamelCase', {}, 'Doesnotexist:CamelCase'),
00067             ('MoinMaster:CamelCase', {}, 'MoinMaster:CamelCase'),
00068             ("MoinMaster:'some page'", {}, '[[MoinMaster:some page]]'),
00069             ('MoinMaster:"some page"', {}, '[[MoinMaster:some page]]'),
00070 
00071             ('[wiki:MoinMoin/FrontPage]', {}, 'MoinMoin:FrontPage'),
00072             ('some_text', {}, 'some_text'),
00073             ('["some_text"]', {}, '[[some_text]]'),
00074             ('some_page', rename_some_page, 'some_page'), # not a link
00075             ('{{{["some_page"]}}}', rename_some_page, '{{{["some_page"]}}}'), # not a link
00076             ('`["some_page"]`', rename_some_page, '`["some_page"]`'), # not a link
00077             ('["OtherPage/some_page"]', rename_some_page, '[[OtherPage/some_page]]'), # different link
00078             ('MoinMaster:some_page', rename_some_page, 'MoinMaster:some_page'), # external link
00079             ('http://some_server/some_page', rename_some_page, 'http://some_server/some_page'), # external link
00080             ('[http://some_server/some_page]', rename_some_page, '[[http://some_server/some_page]]'), # external link
00081             ('[http://some_server/some_page foo]', rename_some_page, '[[http://some_server/some_page|foo]]'), # external link
00082             ('[#some_page]', rename_some_page, '[[#some_page]]'), # link to anchor that has same name
00083             ('[attachment:some_page.png]', rename_some_page, '[[attachment:some_page.png]]'), # att, not page
00084             ('[attachment:some_page.png test picture]', rename_some_page, '[[attachment:some_page.png|test picture]]'), # att, not page
00085 
00086             # page rename changes result
00087             ('["some_page"]', rename_some_page, '[[some page]]'),
00088             ('[:some_page]', rename_some_page, '[[some page]]'),
00089             ('[:some_page#anchor]', rename_some_page, '[[some page#anchor]]'),
00090             ('[:some_page:]', rename_some_page, '[[some page]]'),
00091             ('[:some_page#anchor:]', rename_some_page, '[[some page#anchor]]'),
00092             ('[:some_page:some text]', rename_some_page, '[[some page|some text]]'),
00093             ('[:some_page#anchor:some text]', rename_some_page, '[[some page#anchor|some text]]'),
00094             ('Self:some_page', rename_some_page, '[[some page]]'),
00095             ('wiki:Self:some_page', rename_some_page, '[[some page]]'),
00096             ('[wiki:Self:some_page some text]', rename_some_page, '[[some page|some text]]'),
00097             ('wiki:Self:some_page#some_anchor', rename_some_page, '[[some page#some_anchor]]'),
00098 
00099             # other markup changes we do
00100             ('[:other page]', {}, '[[other page]]'),
00101             ('[:other page:]', {}, '[[other page]]'),
00102             ('[:other page:other text]', {}, '[[other page|other text]]'),
00103             ('Self:CamelCase', {}, 'CamelCase'),
00104             ('[wiki:WikiPedia:Lynx_%28web_browser%29 Lynx]', {}, '[[WikiPedia:Lynx_(web_browser)|Lynx]]'),
00105             ('[:Something:Something]', {}, '[[Something]]'), # optimize markup
00106 
00107             # "nothing changed" checks
00108             ('attachment:OtherPage/with_underscore', rename_some_file, '[[attachment:OtherPage/with_underscore]]'),
00109 
00110             # file rename changes result
00111             ('attachment:with_underscore', rename_some_file, '[[attachment:without underscore]]'),
00112             ('attachment:TestPage/with_underscore', rename_some_file, '[[attachment:without underscore]]'), # remove superfluous pagename
00113 
00114             # embed images, all verified on 160a
00115             ('http://server/image.png', {}, '{{http://server/image.png}}'),
00116             ('attachment:image.gif', {}, '{{attachment:image.gif}}'),
00117             ('inline:image.jpg', {}, '{{attachment:image.jpg}}'), # inline is now implied by {{...}}
00118             ('drawing:image', {}, '{{drawing:image}}'),
00119 
00120             # macros
00121             ('[[BR]]', {}, '<<BR>>'),
00122             ('[[FullSearch(wtf)]]', {}, '<<FullSearch(wtf)>>'),
00123             (u'[[ImageLink(töst.png)]]', {}, u'[[attachment:töst.png|{{attachment:töst.png}}]]'),
00124             ('[[ImageLink(test.png,OtherPage)]]', {}, '[[OtherPage|{{attachment:test.png}}]]'),
00125             ('[[ImageLink(test.png,OtherPage,width=123,height=456)]]', {}, '[[OtherPage|{{attachment:test.png||width=123, height=456}}]]'),
00126             ('[[ImageLink(test.png,OtherPage,width=123,height=456,alt=alttext)]]', {}, '[[OtherPage|{{attachment:test.png|alttext|width=123, height=456}}]]'),
00127             ('[[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}}]]'),
00128             ('[[ImageLink(http://server/test.png,OtherPage,width=123,height=456)]]', {}, '[[OtherPage|{{http://server/test.png||width=123, height=456}}]]'),
00129             ('[[ImageLink(http://server/test.png,http://server/,width=123)]]', {}, '[[http://server/|{{http://server/test.png||width=123}}]]'),
00130             ('[[ImageLink(test.png,attachment:test.png)]]', {}, '[[attachment:test.png|{{attachment:test.png}}]]'),
00131             ('[[ImageLink(test.png,inline:test.py)]]', {}, '[[attachment:test.py|{{attachment:test.png}}]]'),
00132 
00133         ]
00134         for data, renames, expected in tests:
00135             assert convert_wiki(request, pagename, data, renames) == expected

Here is the call graph for this function:

Definition at line 169 of file test_conv160a_wiki.py.

00169 
00170     def test_full_page(self):
00171         #py.test.skip("not wanted right now")
00172         markup_160a = u"""\
00173 = CamelCase =
00174 == Pages ==
00175  1. SomePage
00176  2. TestPage (does not link to current page)
00177  3. SomePage/SubPage
00178 
00179 ## not supported on 160a
00180 ##== Pages with anchor ==
00181 ## 1. SomePage#anchor
00182 ## 2. TestPage#anchor
00183 ## 3. SomePage/SubPage#anchor
00184 
00185 = Interwiki =
00186 == Pages ==
00187  1. Self:SomePage
00188  2. Self:some_page
00189  3. Self:'some page'
00190  4. Self:"some page"
00191  5. MoinMoin:SomePage
00192  6. MoinMoin:some_page
00193  7. MoinMoin:'some page'
00194  8. MoinMoin:"some page"
00195 
00196 == Pages with anchor ==
00197  1. Self:SomePage#anchor
00198  2. Self:some_page#anchor
00199  3. Self:'some page#anchor'
00200  4. Self:"some page#anchor"
00201  5. MoinMoin:SomePage#anchor
00202  6. MoinMoin:some_page#anchor
00203  7. MoinMoin:'some page#anchor'
00204  8. MoinMoin:"some page#anchor"
00205 
00206 == Invalid wiki name ==
00207  1. Doesnotexist:CamelCase (shall not link)
00208  2. Foo:bar (shall not link)
00209 
00210 = URL =
00211 == simple ==
00212  1. http://moinmo.in/MoinMoin
00213  2. http://static.moinmo.in/logos/moinmoin.png (renders image in 160a)
00214  3. mailto:someone@example.org
00215  4. wiki:Self:some_page
00216 
00217 == with anchor ==
00218  1. http://moinmo.in/MoinMoin#anchor
00219  2. wiki:Self:some_page#anchor
00220 
00221 = bracketed link =
00222 == Page ==
00223  1. ["some page"]
00224  2. ["some page" somepage]
00225  3. ['some page' somepage]
00226  4. ["/Subpage"]
00227  5. ["SomePage/Subpage"]
00228  6. ['SomePage/Subpage' Some Page]
00229 
00230 == Page with anchor ==
00231  1. ["some page#anchor"]
00232  2. ["some page#anchor" somepage]
00233  3. ['some page#anchor' somepage]
00234  4. ["/Subpage#anchor"]
00235  5. ["SomePage/Subpage#anchor"]
00236  6. ['SomePage/Subpage#anchor' Some Page]
00237 
00238 == Anchor on current page ==
00239  1. [#anchor]
00240 ## 1. [TestPage#anchor]  not supported on 160a
00241 
00242 == URL ==
00243  1. [http://some_server/some_page]
00244  2. [http://some_server/some_page some page]
00245  3. [wiki:MoinMoin/FrontPage]
00246  4. [wiki:Self:some_page some page]
00247  5. [wiki:WikiPedia:Lynx_(web_browser) Lynx]
00248  6. [:some_page]
00249  7. [:some_page:]
00250  8. [:some_page:some page]
00251  9. [:Something:Something]
00252 
00253 == URL with anchor ==
00254  1. [http://some_server/some_page#anchor]
00255  2. [http://some_server/some_page#anchor some page]
00256  3. [wiki:MoinMoin/FrontPage#anchor]
00257  4. [wiki:Self:some_page#anchor some page]
00258  5. [wiki:WikiPedia:Lynx_(web_browser)#anchor Lynx]
00259  6. [:some_page#anchor]
00260  7. [:some_page#anchor:]
00261  8. [:some_page#anchor:some page]
00262  9. [:Something#anchor:Something]
00263 
00264 = preformatted =
00265  1. {{{["some_page"]}}} (converter shall not change pre content)
00266  2. `["some_page"]` (converter shall not change pre content)
00267 
00268 = Attachments, Drawings, Images =
00269 == simple ==
00270  1. attachment:text.txt is linking
00271  2. inline:text.txt is embedding
00272  3. attachment:image.png is embedding
00273  4. inline:image.png is embedding
00274  5. drawing:image is embedding
00275 
00276 == bracketed ==
00277  1. [attachment:text.txt] is linking
00278  2. [inline:text.txt] is embedding
00279  3. [attachment:image.png] is linking
00280  4. [drawing:image] is embedding png image
00281  5. [inline:image.png] is showing binary content as text in 160a (wrong)
00282 
00283 == bracketed with label ==
00284  1. [attachment:text.txt some label] is linking
00285  2. [inline:text.txt some label] is embedding
00286  3. [attachment:image.png some label] is linking
00287  4. [drawing:image some label] is embedding png image
00288  5. [inline:image.png some label] is showing binary content as text in 160a (wrong)
00289 
00290 == bracketed, on other page, with label ==
00291  1. [attachment:SomePage/text.txt some label] is linking
00292  2. [inline:SomePage/text.txt some label] is embedding
00293  3. [attachment:SomePage/image.png some label] is linking
00294  4. [drawing:SomePage/image some label] is embedding png image
00295  5. [inline:SomePage/image.png some label] is showing binary content as text in 160a (wrong)
00296 
00297 """
00298         expected_markup_160 = u"""\
00299 = CamelCase =
00300 == Pages ==
00301  1. SomePage
00302  2. TestPage (does not link to current page)
00303  3. [[SomePage/SubPage]]
00304 
00305 ## not supported on 160a
00306 ##== Pages with anchor ==
00307 ## 1. SomePage#anchor
00308 ## 2. TestPage#anchor
00309 ## 3. SomePage/SubPage#anchor
00310 
00311 = Interwiki =
00312 == Pages ==
00313  1. SomePage
00314  2. [[some_page]]
00315  3. [[some page]]
00316  4. [[some page]]
00317  5. MoinMoin:SomePage
00318  6. MoinMoin:some_page
00319  7. [[MoinMoin:some page]]
00320  8. [[MoinMoin:some page]]
00321 
00322 == Pages with anchor ==
00323  1. [[SomePage#anchor]]
00324  2. [[some_page#anchor]]
00325  3. [[some page#anchor]]
00326  4. [[some page#anchor]]
00327  5. MoinMoin:SomePage#anchor
00328  6. MoinMoin:some_page#anchor
00329  7. [[MoinMoin:some page#anchor]]
00330  8. [[MoinMoin:some page#anchor]]
00331 
00332 == Invalid wiki name ==
00333  1. Doesnotexist:CamelCase (shall not link)
00334  2. Foo:bar (shall not link)
00335 
00336 = URL =
00337 == simple ==
00338  1. http://moinmo.in/MoinMoin
00339  2. {{http://static.moinmo.in/logos/moinmoin.png}} (renders image in 160a)
00340  3. mailto:someone@example.org
00341  4. [[some_page]]
00342 
00343 == with anchor ==
00344  1. http://moinmo.in/MoinMoin#anchor
00345  2. [[some_page#anchor]]
00346 
00347 = bracketed link =
00348 == Page ==
00349  1. [[some page]]
00350  2. [[some page|somepage]]
00351  3. [[some page|somepage]]
00352  4. [[/Subpage]]
00353  5. [[SomePage/Subpage]]
00354  6. [[SomePage/Subpage|Some Page]]
00355 
00356 == Page with anchor ==
00357  1. [[some page#anchor]]
00358  2. [[some page#anchor|somepage]]
00359  3. [[some page#anchor|somepage]]
00360  4. [[/Subpage#anchor]]
00361  5. [[SomePage/Subpage#anchor]]
00362  6. [[SomePage/Subpage#anchor|Some Page]]
00363 
00364 == Anchor on current page ==
00365  1. [[#anchor]]
00366 ## 1. [TestPage#anchor]  not supported on 160a
00367 
00368 == URL ==
00369  1. [[http://some_server/some_page]]
00370  2. [[http://some_server/some_page|some page]]
00371  3. MoinMoin:FrontPage
00372  4. [[some_page|some page]]
00373  5. [[WikiPedia:Lynx_(web_browser)|Lynx]]
00374  6. [[some_page]]
00375  7. [[some_page]]
00376  8. [[some_page|some page]]
00377  9. [[Something]]
00378 
00379 == URL with anchor ==
00380  1. [[http://some_server/some_page#anchor]]
00381  2. [[http://some_server/some_page#anchor|some page]]
00382  3. MoinMoin:FrontPage#anchor
00383  4. [[some_page#anchor|some page]]
00384  5. [[WikiPedia:Lynx_(web_browser)#anchor|Lynx]]
00385  6. [[some_page#anchor]]
00386  7. [[some_page#anchor]]
00387  8. [[some_page#anchor|some page]]
00388  9. [[Something#anchor|Something]]
00389 
00390 = preformatted =
00391  1. {{{["some_page"]}}} (converter shall not change pre content)
00392  2. `["some_page"]` (converter shall not change pre content)
00393 
00394 = Attachments, Drawings, Images =
00395 == simple ==
00396  1. [[attachment:text.txt]] is linking
00397  2. {{attachment:text.txt}} is embedding
00398  3. {{attachment:image.png}} is embedding
00399  4. {{attachment:image.png}} is embedding
00400  5. {{drawing:image}} is embedding
00401 
00402 == bracketed ==
00403  1. [[attachment:text.txt]] is linking
00404  2. {{attachment:text.txt}} is embedding
00405  3. [[attachment:image.png]] is linking
00406  4. {{drawing:image}} is embedding png image
00407  5. {{attachment:image.png}} is showing binary content as text in 160a (wrong)
00408 
00409 == bracketed with label ==
00410  1. [[attachment:text.txt|some label]] is linking
00411  2. {{attachment:text.txt|some label}} is embedding
00412  3. [[attachment:image.png|some label]] is linking
00413  4. {{drawing:image|some label}} is embedding png image
00414  5. {{attachment:image.png|some label}} is showing binary content as text in 160a (wrong)
00415 
00416 == bracketed, on other page, with label ==
00417  1. [[attachment:SomePage/text.txt|some label]] is linking
00418  2. {{attachment:SomePage/text.txt|some label}} is embedding
00419  3. [[attachment:SomePage/image.png|some label]] is linking
00420  4. {{drawing:SomePage/image|some label}} is embedding png image
00421  5. {{attachment:SomePage/image.png|some label}} is showing binary content as text in 160a (wrong)
00422 
00423 """
00424         markup_160 = convert_wiki(self.request, u'TestPage', markup_160a, {})
00425         #print markup_160a ; print "---" ; print markup_160
00426         markup_160 = markup_160.replace('\r\n', '\n')
00427         assert markup_160 == expected_markup_160

Here is the call graph for this function:

Definition at line 428 of file test_conv160a_wiki.py.

00428 
00429     def test_parser(self):
00430         markup_160a = u"""\
00431 {{{#!html
00432 ...
00433 }}}
00434 
00435 """
00436         expected_markup_160 = u"""\
00437 {{{#!html
00438 ...
00439 }}}
00440 
00441 """
00442         markup_160 = convert_wiki(self.request, u'TestPage', markup_160a, {})
00443         #print markup_160a ; print "---" ; print markup_160
00444         markup_160 = markup_160.replace('\r\n', '\n')
00445         assert markup_160 == expected_markup_160

Here is the call graph for this function:

Definition at line 446 of file test_conv160a_wiki.py.

00446 
00447     def test_pre(self):
00448         markup_160a = u"""\
00449 {{{
00450 ...
00451 }}}
00452 
00453 """
00454         expected_markup_160 = u"""\
00455 {{{
00456 ...
00457 }}}
00458 
00459 """
00460         markup_160 = convert_wiki(self.request, u'TestPage', markup_160a, {})
00461         #print markup_160a ; print "---" ; print markup_160
00462         markup_160 = markup_160.replace('\r\n', '\n')
00463         assert markup_160 == expected_markup_160
00464 

Here is the call graph for this function:

Definition at line 136 of file test_conv160a_wiki.py.

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

Here is the call graph for this function:

Definition at line 153 of file test_conv160a_wiki.py.

00153 
00154     def test_subpage(self):
00155         request = self.request
00156         pagename = 'toppage'
00157         rename_some_page = {
00158                 ('PAGE', '%s/subpage' % pagename): '%s/renamed_subpage' % pagename,
00159         }
00160         tests = [
00161             # "nothing changed" checks
00162             ('["/subpage_norename"]', rename_some_page, '[[/subpage_norename]]'),
00163 
00164             # renames
00165             ('["/subpage"]', rename_some_page, '[[/renamed_subpage]]'),
00166         ]
00167         for data, renames, expected in tests:
00168             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: