comparison MoinMoin/request/_tests/test_request.py @ 4027:0d6724b87856

Refactored TestConfig creation for py.test based unit tests. The method used before had multiple problems: config creation did not use inheritance (as it does when used the wiki in production). It also didn't do the post processing done in __init__ of Config class. Also, it first created the request with some default config, then created the TestConfig (but some stuff in request was not initialized correctly)... The new method now uses config inheritance in the same way as a production wiki does. The TestConfig instance is created in RequestBase __init__, it does not use sys.path any more to import the test wikiconfig, but does an absolute import from MoinMoin._tests.wikiconfig. TODO: * fix the failing test_pysupport.TestImportExisting.testExisting * auth tests are currently skipped because they need more work * find a better way than staticmethod(TestConfig)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 24 Aug 2008 02:01:34 +0200
parents 6162f334bd5a
children
comparison
equal deleted inserted replaced
4026:d3c2d8d89959 4027:0d6724b87856
8 """ 8 """
9 9
10 import py 10 import py
11 11
12 from MoinMoin import config, wikiutil 12 from MoinMoin import config, wikiutil
13 from MoinMoin._tests import wikiconfig
13 14
14 from MoinMoin.request import HeadersAlreadySentException 15 from MoinMoin.request import HeadersAlreadySentException
15 16
16 class TestNormalizePagename(object): 17 class TestNormalizePagename(object):
17 18
71 assert result == expected 72 assert result == expected
72 73
73 74
74 class TestGroupPages(object): 75 class TestGroupPages(object):
75 76
76 def setup_method(self, method):
77 self.config = self.TestConfig(page_group_regex=r'.+Group')
78
79 def teardown_method(self, method):
80 del self.config
81
82 def testNormalizeGroupName(self): 77 def testNormalizeGroupName(self):
83 """ request: normalize pagename: restrict groups to alpha numeric Unicode 78 """ request: normalize pagename: restrict groups to alpha numeric Unicode
84 79
85 Spaces should normalize after invalid chars removed! 80 Spaces should normalize after invalid chars removed!
86 """ 81 """