comparison MoinMoin/script/migration/_tests/test_conv160a_wiki.py @ 4488:a2a05ae3e7ec

1.6.0a mig script/converter: add tests, improve test compliance, clean up
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 15 Jan 2009 23:37:36 +0100
parents 44d856f8a110
children a835ada897e0
comparison
equal deleted inserted replaced
4487:c3cae273af82 4488:a2a05ae3e7ec
35 ('FILE', pagename, 'with_underscore'): 'without underscore', 35 ('FILE', pagename, 'with_underscore'): 'without underscore',
36 ('FILE', pagename, 'with blank'): 'without_blank', 36 ('FILE', pagename, 'with blank'): 'without_blank',
37 } 37 }
38 38
39 tests = [ 39 tests = [
40 # 1.6.0a specific tests (jk)
41 # attachment links
42 ("attachment:filename.ext", {}, "[[attachment:filename.ext]]"),
43 ("[attachment:'Filename.ext' Aliasname]", {}, "[[attachment:Filename.ext|Aliasname]]"),
44 ("[attachment:'Pagename/Filename.ext' Aliasname]", {}, "[[attachment:Pagename/Filename.ext|Aliasname]]"),
45 ("[attachment:'Pagename/Subpage/Filename.ext' Aliasname]", {}, "[[attachment:Pagename/Subpage/Filename.ext|Aliasname]]"),
46 ('[attachment:"Pagename/Subpage/File Name.ext" Aliasname]', {}, "[[attachment:Pagename/Subpage/File Name.ext|Aliasname]]"),
47 # page links
48 ('["Pagename"]', {}, "[[Pagename]]"),
49 ('["/Subpage"]', {}, "[[/Subpage]]"),
50 ('["Pagename/Subpage"]', {}, "[[Pagename/Subpage]]"),
51 ("['Pagename/Subpage' Aliasname]", {}, "[[Pagename/Subpage|Aliasname]]"),
52 # other links
53 ("[http://google.de google]", {}, "[[http://google.de|google]]"),
54 # other stuff
55 ("[[GetText(To)]]", {}, "<<GetText(To)>>"),
56
40 # 1.6.0a specific tests 57 # 1.6.0a specific tests
41 ('["some page" somepage]', {}, '[[some page|somepage]]'), 58 ('["some page" somepage]', {}, '[[some page|somepage]]'),
42 ("['some page' somepage]", {}, '[[some page|somepage]]'), 59 ("['some page' somepage]", {}, '[[some page|somepage]]'),
43 ("MoinMaster:'some page'", {}, '[[MoinMaster:some page]]'), 60 ("MoinMaster:'some page'", {}, '[[MoinMaster:some page]]'),
44 ('MoinMaster:"some page"', {}, '[[MoinMaster:some page]]'), 61 ('MoinMaster:"some page"', {}, '[[MoinMaster:some page]]'),
62 ('["OtherPage/some_page"]', rename_some_page, '[[OtherPage/some_page]]'), # different link 79 ('["OtherPage/some_page"]', rename_some_page, '[[OtherPage/some_page]]'), # different link
63 # XXX TODO ('MoinMaster:some_page', rename_some_page, 'MoinMaster:some_page'), # external link 80 # XXX TODO ('MoinMaster:some_page', rename_some_page, 'MoinMaster:some_page'), # external link
64 ('http://some_server/some_page', rename_some_page, 'http://some_server/some_page'), # external link 81 ('http://some_server/some_page', rename_some_page, 'http://some_server/some_page'), # external link
65 ('[http://some_server/some_page]', rename_some_page, '[[http://some_server/some_page]]'), # external link 82 ('[http://some_server/some_page]', rename_some_page, '[[http://some_server/some_page]]'), # external link
66 ('[#some_page]', rename_some_page, '[[#some_page]]'), # link to anchor that has same name 83 ('[#some_page]', rename_some_page, '[[#some_page]]'), # link to anchor that has same name
67 #XXX ('[attachment:some_page.png]', rename_some_page, '[[attachment:some_page.png]]'), # att, not page 84 ('[attachment:some_page.png]', rename_some_page, '[[attachment:some_page.png]]'), # att, not page
68 #XXX ('[attachment:some_page.png test picture]', rename_some_page, '[[attachment:some_page.png|test picture]]'), # att, not page 85 ('[attachment:some_page.png test picture]', rename_some_page, '[[attachment:some_page.png|test picture]]'), # att, not page
69 # url unquote stuff (%20 was popular for space)
70 #XXX ('attachment:My%20Attachment.jpg', {}, '{{attachment:My Attachment.jpg}}'), # embed!
71 #XXX ('[attachment:My%20Attachment.jpg]', {}, '[[attachment:My Attachment.jpg]]'), # link!
72 #XXX ('[attachment:My%20Attachment.jpg it works]', {}, '[[attachment:My Attachment.jpg|it works]]'),
73 86
74 # page rename changes result 87 # page rename changes result
75 ('["some_page"]', rename_some_page, '[[some page]]'), 88 ('["some_page"]', rename_some_page, '[[some page]]'),
76 ('[:some_page]', rename_some_page, '[[some page]]'), 89 ('[:some_page]', rename_some_page, '[[some page]]'),
90 ('[:some_page#anchor]', rename_some_page, '[[some page#anchor]]'),
77 ('[:some_page:]', rename_some_page, '[[some page]]'), 91 ('[:some_page:]', rename_some_page, '[[some page]]'),
92 ('[:some_page#anchor:]', rename_some_page, '[[some page#anchor]]'),
78 ('[:some_page:some text]', rename_some_page, '[[some page|some text]]'), 93 ('[:some_page:some text]', rename_some_page, '[[some page|some text]]'),
94 ('[:some_page#anchor:some text]', rename_some_page, '[[some page#anchor|some text]]'),
79 ('Self:some_page', rename_some_page, '[[some page]]'), 95 ('Self:some_page', rename_some_page, '[[some page]]'),
80 ('wiki:Self:some_page', rename_some_page, '[[some page]]'), 96 ('wiki:Self:some_page', rename_some_page, '[[some page]]'),
81 ('[wiki:Self:some_page some text]', rename_some_page, '[[some page|some text]]'), 97 ('[wiki:Self:some_page some text]', rename_some_page, '[[some page|some text]]'),
82 ('wiki:Self:some_page#some_anchor', rename_some_page, '[[some page#some_anchor]]'), 98 ('wiki:Self:some_page#some_anchor', rename_some_page, '[[some page#some_anchor]]'),
83 99
85 ('[:other page]', {}, '[[other page]]'), 101 ('[:other page]', {}, '[[other page]]'),
86 ('[:other page:]', {}, '[[other page]]'), 102 ('[:other page:]', {}, '[[other page]]'),
87 ('[:other page:other text]', {}, '[[other page|other text]]'), 103 ('[:other page:other text]', {}, '[[other page|other text]]'),
88 # XXX TODO ('Self:CamelCase', {}, 'CamelCase'), 104 # XXX TODO ('Self:CamelCase', {}, 'CamelCase'),
89 # XXX TODO ('[wiki:WikiPedia:Lynx_%28web_browser%29 Lynx]', {}, '[[WikiPedia:Lynx_(web_browser)|Lynx]]'), 105 # XXX TODO ('[wiki:WikiPedia:Lynx_%28web_browser%29 Lynx]', {}, '[[WikiPedia:Lynx_(web_browser)|Lynx]]'),
90 # XXX TODO ('[:Something:Something]', {}, '[[Something]]'), # optimize markup 106 ('[:Something:Something]', {}, '[[Something]]'), # optimize markup
91 107
92 # "nothing changed" checks 108 # "nothing changed" checks
93 ('attachment:OtherPage/with_underscore', rename_some_file, '[[attachment:OtherPage/with_underscore]]'), 109 ('attachment:OtherPage/with_underscore', rename_some_file, '[[attachment:OtherPage/with_underscore]]'),
94 110
95 # file rename changes result 111 # file rename changes result
96 # XXX TODO ('attachment:with_underscore', rename_some_file, '[[attachment:without underscore]]'), 112 ('attachment:with_underscore', rename_some_file, '[[attachment:without underscore]]'),
97 # XXX TODO ('attachment:TestPage/with_underscore', rename_some_file, '[[attachment:without underscore]]'), # remove superfluous pagename 113 ('attachment:TestPage/with_underscore', rename_some_file, '[[attachment:without underscore]]'), # remove superfluous pagename
98 114
99 # attachment syntax: kill %20 115 # embed images, all verified on 160a
100 # XXX TODO ('attachment:with%20blank', rename_some_file, '[[attachment:without_blank]]'), # plus rename
101 # XXX TODO ('attachment:keep%20blank', rename_some_file, '[[attachment:keep blank]]'), # no rename
102 # XXX TODO ('attachment:TestPage/keep%20blank', rename_some_file, '[[attachment:keep blank]]'), # remove superfluous pagename
103 # XXX TODO ('attachment:OtherPage/keep%20blank', rename_some_file, '[[attachment:OtherPage/keep blank]]'),
104
105 # embed images
106 ('http://server/image.png', {}, '{{http://server/image.png}}'), 116 ('http://server/image.png', {}, '{{http://server/image.png}}'),
107 ('attachment:image.gif', {}, '{{attachment:image.gif}}'), 117 ('attachment:image.gif', {}, '{{attachment:image.gif}}'),
108 ('inline:image.jpg', {}, '{{attachment:image.jpg}}'), # inline is now implied by {{...}} 118 ('inline:image.jpg', {}, '{{attachment:image.jpg}}'), # inline is now implied by {{...}}
109 ('drawing:image', {}, '{{drawing:image}}'), 119 ('drawing:image', {}, '{{drawing:image}}'),
110 120