annotate MoinMoin/script/migration/_tests/test_conv160a_wiki.py @ 4489:a835ada897e0

1.6.0a mig script/converter: fix interwiki tests, cleanup
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 16 Jan 2009 01:42:02 +0100
parents a2a05ae3e7ec
children b120d9978144
rev   line source
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - tests of wiki content conversion
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5 TODO:
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 * fix parser/converter anchor link handling
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 * emit a warning if we find some page name that was renamed as a macro argument?
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8 * shall we support camelcase renaming?
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10 Limitations of this converter:
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11 * converter does not touch "pre sections", thus markup examples in {{{ }}}
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 or ` ` will have to get handled manually.
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13 * converter does not touch macro arguments, they will have to get handled
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 manually
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 * converter does not touch CamelCase links (but there should be no need to do)
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 @copyright: 2007 MoinMoin:ThomasWaldmann
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 @license: GNU GPL, see COPYING for details.
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19 """
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 import py
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 #py.test.skip("broken")
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 from MoinMoin.script.migration._conv160a_wiki import convert_wiki
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25 class TestWikiConversion:
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26 """ test the wiki markup conversion 1.6.0a -> 1.6.0 """
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 def test_absolute(self):
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 request = self.request
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 pagename = 'TestPage'
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30 rename_some_page = {
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31 ('PAGE', 'some_page'): 'some page',
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 }
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33 rename_some_file = {
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 ('FILE', pagename, 'with_underscore'): 'without underscore',
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35 ('FILE', pagename, 'with blank'): 'without_blank',
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
36 }
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
37
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38 tests = [
4488
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
39 # attachment links
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
40 ("attachment:filename.ext", {}, "[[attachment:filename.ext]]"),
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
41 ("[attachment:'Filename.ext' Aliasname]", {}, "[[attachment:Filename.ext|Aliasname]]"),
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
42 ("[attachment:'Pagename/Filename.ext' Aliasname]", {}, "[[attachment:Pagename/Filename.ext|Aliasname]]"),
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
43 ("[attachment:'Pagename/Subpage/Filename.ext' Aliasname]", {}, "[[attachment:Pagename/Subpage/Filename.ext|Aliasname]]"),
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
44 ('[attachment:"Pagename/Subpage/File Name.ext" Aliasname]', {}, "[[attachment:Pagename/Subpage/File Name.ext|Aliasname]]"),
4489
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
45
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
46 # "nothing changed" checks (except markup)
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
47 ('', {}, ''),
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
48 ('CamelCase', {}, 'CamelCase'),
4488
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
49 ('["/Subpage"]', {}, "[[/Subpage]]"),
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
50 ('["Pagename/Subpage"]', {}, "[[Pagename/Subpage]]"),
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
51 ("['Pagename/Subpage' Aliasname]", {}, "[[Pagename/Subpage|Aliasname]]"),
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
52 ('["some page" somepage]', {}, '[[some page|somepage]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
53 ("['some page' somepage]", {}, '[[some page|somepage]]'),
4489
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
54
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
55 ('Doesnotexist:CamelCase', {}, 'Doesnotexist:CamelCase'),
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
56 ('MoinMaster:CamelCase', {}, 'MoinMaster:CamelCase'),
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
57 ("MoinMaster:'some page'", {}, '[[MoinMaster:some page]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
58 ('MoinMaster:"some page"', {}, '[[MoinMaster:some page]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
59
4489
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
60 ('[wiki:MoinMoin/FrontPage]', {}, 'MoinMoin:FrontPage'),
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
61 ('some_text', {}, 'some_text'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
62 ('["some_text"]', {}, '[[some_text]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
63 ('some_page', rename_some_page, 'some_page'), # not a link
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
64 ('{{{["some_page"]}}}', rename_some_page, '{{{["some_page"]}}}'), # not a link
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
65 ('`["some_page"]`', rename_some_page, '`["some_page"]`'), # not a link
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
66 ('["OtherPage/some_page"]', rename_some_page, '[[OtherPage/some_page]]'), # different link
4489
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
67 ('MoinMaster:some_page', rename_some_page, 'MoinMaster:some_page'), # external link
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
68 ('http://some_server/some_page', rename_some_page, 'http://some_server/some_page'), # external link
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
69 ('[http://some_server/some_page]', rename_some_page, '[[http://some_server/some_page]]'), # external link
4489
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
70 ('[http://some_server/some_page foo]', rename_some_page, '[[http://some_server/some_page|foo]]'), # external link
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
71 ('[#some_page]', rename_some_page, '[[#some_page]]'), # link to anchor that has same name
4488
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
72 ('[attachment:some_page.png]', rename_some_page, '[[attachment:some_page.png]]'), # att, not page
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
73 ('[attachment:some_page.png test picture]', rename_some_page, '[[attachment:some_page.png|test picture]]'), # att, not page
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
74
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
75 # page rename changes result
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
76 ('["some_page"]', rename_some_page, '[[some page]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
77 ('[:some_page]', rename_some_page, '[[some page]]'),
4488
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
78 ('[:some_page#anchor]', rename_some_page, '[[some page#anchor]]'),
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
79 ('[:some_page:]', rename_some_page, '[[some page]]'),
4488
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
80 ('[:some_page#anchor:]', rename_some_page, '[[some page#anchor]]'),
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
81 ('[:some_page:some text]', rename_some_page, '[[some page|some text]]'),
4488
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
82 ('[:some_page#anchor:some text]', rename_some_page, '[[some page#anchor|some text]]'),
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
83 ('Self:some_page', rename_some_page, '[[some page]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
84 ('wiki:Self:some_page', rename_some_page, '[[some page]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85 ('[wiki:Self:some_page some text]', rename_some_page, '[[some page|some text]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
86 ('wiki:Self:some_page#some_anchor', rename_some_page, '[[some page#some_anchor]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
87
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
88 # other markup changes we do
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
89 ('[:other page]', {}, '[[other page]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
90 ('[:other page:]', {}, '[[other page]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
91 ('[:other page:other text]', {}, '[[other page|other text]]'),
4489
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
92 ('Self:CamelCase', {}, 'CamelCase'),
a835ada897e0 1.6.0a mig script/converter: fix interwiki tests, cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4488
diff changeset
93 ('[wiki:WikiPedia:Lynx_%28web_browser%29 Lynx]', {}, '[[WikiPedia:Lynx_(web_browser)|Lynx]]'),
4488
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
94 ('[:Something:Something]', {}, '[[Something]]'), # optimize markup
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
95
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
96 # "nothing changed" checks
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
97 ('attachment:OtherPage/with_underscore', rename_some_file, '[[attachment:OtherPage/with_underscore]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99 # file rename changes result
4488
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
100 ('attachment:with_underscore', rename_some_file, '[[attachment:without underscore]]'),
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
101 ('attachment:TestPage/with_underscore', rename_some_file, '[[attachment:without underscore]]'), # remove superfluous pagename
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
102
4488
a2a05ae3e7ec 1.6.0a mig script/converter: add tests, improve test compliance, clean up
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3925
diff changeset
103 # embed images, all verified on 160a
3925
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
104 ('http://server/image.png', {}, '{{http://server/image.png}}'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
105 ('attachment:image.gif', {}, '{{attachment:image.gif}}'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
106 ('inline:image.jpg', {}, '{{attachment:image.jpg}}'), # inline is now implied by {{...}}
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
107 ('drawing:image', {}, '{{drawing:image}}'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
109 # macros
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
110 ('[[BR]]', {}, '<<BR>>'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
111 ('[[FullSearch(wtf)]]', {}, '<<FullSearch(wtf)>>'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
112 (u'[[ImageLink(töst.png)]]', {}, u'[[attachment:töst.png|{{attachment:töst.png}}]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
113 ('[[ImageLink(test.png,OtherPage)]]', {}, '[[OtherPage|{{attachment:test.png}}]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
114 ('[[ImageLink(test.png,OtherPage,width=123,height=456)]]', {}, '[[OtherPage|{{attachment:test.png||width=123, height=456}}]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
115 ('[[ImageLink(test.png,OtherPage,width=123,height=456,alt=alttext)]]', {}, '[[OtherPage|{{attachment:test.png|alttext|width=123, height=456}}]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
116 ('[[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}}]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
117 ('[[ImageLink(http://server/test.png,OtherPage,width=123,height=456)]]', {}, '[[OtherPage|{{http://server/test.png||width=123, height=456}}]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
118 ('[[ImageLink(http://server/test.png,http://server/,width=123)]]', {}, '[[http://server/|{{http://server/test.png||width=123}}]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
119 ('[[ImageLink(test.png,attachment:test.png)]]', {}, '[[attachment:test.png|{{attachment:test.png}}]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
120 ('[[ImageLink(test.png,inline:test.py)]]', {}, '[[attachment:test.py|{{attachment:test.png}}]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
121
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
122 ]
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
123 for data, renames, expected in tests:
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
124 assert convert_wiki(request, pagename, data, renames) == expected
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
125
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
126 def test_sisterpage(self):
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
127 request = self.request
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
128 top_page = 'toppage'
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
129 pagename = '%s/subpage' % top_page
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
130 rename_some_page = {
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
131 ('PAGE', '%s/sister' % top_page): '%s/renamed_sister' % top_page,
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
132 }
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
133 tests = [
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
134 # "nothing changed" checks
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
135 ('["../sister_norename"]', rename_some_page, '[[../sister_norename]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
136
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
137 # renames
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
138 ('["../sister"]', rename_some_page, '[[../renamed_sister]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
139 ]
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
140 for data, renames, expected in tests:
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
141 assert convert_wiki(request, pagename, data, renames) == expected
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
142
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
143 def test_subpage(self):
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
144 request = self.request
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
145 pagename = 'toppage'
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
146 rename_some_page = {
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
147 ('PAGE', '%s/subpage' % pagename): '%s/renamed_subpage' % pagename,
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
148 }
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
149 tests = [
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
150 # "nothing changed" checks
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
151 ('["/subpage_norename"]', rename_some_page, '[[/subpage_norename]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
152
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
153 # renames
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
154 ('["/subpage"]', rename_some_page, '[[/renamed_subpage]]'),
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
155 ]
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
156 for data, renames, expected in tests:
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
157 assert convert_wiki(request, pagename, data, renames) == expected
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
158
44d856f8a110 add migration support to migrate from early 1.6.0alpha to 1.6.0 release
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
159