comparison MoinMoin/script/migration/_tests/test_conv160_wiki.py @ 2606:482f0a9e555c

1.6 converter: add more tests, TODO, fixed sourcecode test failure
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 05 Aug 2007 14:47:10 +0200
parents 27f06531a91b
children 3ff3beef1edf
comparison
equal deleted inserted replaced
2605:a12f848eee3c 2606:482f0a9e555c
1 # -*- coding: iso-8859-1 -*- 1 # -*- coding: iso-8859-1 -*-
2 """ 2 """
3 MoinMoin - tests of wiki content conversion 3 MoinMoin - tests of wiki content conversion
4
5 TODO:
6 * add some ../some_page test
7 * add some /some_page test
8 * fix parser/converter anchor link handling
9 * emit a warning if we find some page name that was renamed as a macro argument
10 * shall we support camelcase renaming?
4 11
5 @copyright: 2007 MoinMoin:ThomasWaldmann 12 @copyright: 2007 MoinMoin:ThomasWaldmann
6 @license: GNU GPL, see COPYING for details. 13 @license: GNU GPL, see COPYING for details.
7 """ 14 """
8 15
10 17
11 def test_wiki_conversion(request): 18 def test_wiki_conversion(request):
12 pagename = 'TestPage' 19 pagename = 'TestPage'
13 rename_some_page = { 20 rename_some_page = {
14 ('PAGE', 'some_page'): 'some page', 21 ('PAGE', 'some_page'): 'some page',
22 # NEEDED? ('PAGE', 'RenameThis'): 'ThisRenamed',
15 } 23 }
16 rename_some_file = { 24 rename_some_file = {
17 ('FILE', pagename, 'with_underscore'): 'without underscore', 25 ('FILE', pagename, 'with_underscore'): 'without underscore',
18 ('FILE', pagename, 'with blank'): 'without_blank', 26 ('FILE', pagename, 'with blank'): 'without_blank',
19 } 27 }
20 tests = [ 28 tests = [
29 # NEEDED? ('CamelCase', {}, 'CamelCase'),
30 # FAILS ('RenameThis', rename_some_page, 'ThisRenamed'),
31 # NEEDED? ('!RenameThis', {}, '!RenameThis'), # not a link
32
21 # "nothing changed" checks 33 # "nothing changed" checks
22 ('', {}, ''), 34 ('', {}, ''),
23 ('CamelCase', {}, 'CamelCase'),
24 ('MoinMaster:CamelCase', {}, 'MoinMaster:CamelCase'), 35 ('MoinMaster:CamelCase', {}, 'MoinMaster:CamelCase'),
25 ('some_text', {}, 'some_text'), 36 ('some_text', {}, 'some_text'),
26 ('["some_text"]', {}, '["some_text"]'), 37 ('["some_text"]', {}, '["some_text"]'),
27 ('some_page', rename_some_page, 'some_page'), # not a link 38 ('some_page', rename_some_page, 'some_page'), # not a link
39 ('{{{["some_page"]}}}', rename_some_page, '{{{["some_page"]}}}'), # not a link
40 ('`["some_page"]`', rename_some_page, '`["some_page"]`'), # not a link
41 ('["OtherPage/some_page"]', rename_some_page, '["OtherPage/some_page"]'), # different link
42 ('MoinMaster:some_page', rename_some_page, 'MoinMaster:some_page'), # external link
43 ('http://some_server/some_page', rename_some_page, 'http://some_server/some_page'), # external link
44 ('[http://some_server/some_page]', rename_some_page, '[http://some_server/some_page]'), # external link
45 ('[#some_page]', rename_some_page, '[#some_page]'), # link to anchor that has same name
28 46
29 # page rename changes result 47 # page rename changes result
30 ('["some_page"]', rename_some_page, '["some page"]'), 48 ('["some_page"]', rename_some_page, '["some page"]'),
31 ('[:some_page]', rename_some_page, '["some page"]'), 49 ('[:some_page]', rename_some_page, '["some page"]'),
32 ('[:some_page:]', rename_some_page, '["some page"]'), 50 ('[:some_page:]', rename_some_page, '["some page"]'),
33 ('[:some_page:some text]', rename_some_page, '["some page" some text]'), 51 ('[:some_page:some text]', rename_some_page, '["some page" some text]'),
34 ('Self:some_page', rename_some_page, '["some page"]'), 52 ('Self:some_page', rename_some_page, '["some page"]'),
35 ('wiki:Self:some_page', rename_some_page, '["some page"]'), 53 ('wiki:Self:some_page', rename_some_page, '["some page"]'),
54 # XXX FAILS ('wiki:Self:some_page#some_anchor', rename_some_page, '["some page"#some_anchor]'),
36 ('[wiki:Self:some_page]', rename_some_page, '["some page"]'), 55 ('[wiki:Self:some_page]', rename_some_page, '["some page"]'),
37 ('[wiki:Self:some_page some text]', rename_some_page, '["some page" some text]'), 56 ('[wiki:Self:some_page some text]', rename_some_page, '["some page" some text]'),
38 57
39 # other markup changes we do 58 # other markup changes we do
40 ('[:other page]', {}, '["other page"]'), 59 ('[:other page]', {}, '["other page"]'),