comparison MoinMoin/_tests/test_user.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 2f2c95506713
children 62177a952833 052b6926c82d
comparison
equal deleted inserted replaced
4026:d3c2d8d89959 4027:0d6724b87856
176 py.test.skip("Can't create test user") 176 py.test.skip("Can't create test user")
177 177
178 178
179 class TestGroupName(object): 179 class TestGroupName(object):
180 180
181 def setUp(self):
182 self.config = self.TestConfig(page_group_regex=r'.+Group')
183
184 def tearDown(self):
185 del self.config
186
187 import re
188 group = re.compile(r'.+Group', re.UNICODE)
189
190 def testGroupNames(self): 181 def testGroupNames(self):
191 """ user: isValidName: reject group names """ 182 """ user: isValidName: reject group names """
192 test = u'AdminGroup' 183 test = u'AdminGroup'
193 assert self.group.search(test)
194 assert not user.isValidName(self.request, test) 184 assert not user.isValidName(self.request, test)
195 185
196 186
197 class TestIsValidName(object): 187 class TestIsValidName(object):
198 188