diff MoinMoin/request/request_cli.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 fee546fba271
children 84c05e657b47
line wrap: on
line diff
--- a/MoinMoin/request/request_cli.py	Fri Aug 22 23:30:38 2008 +0200
+++ b/MoinMoin/request/request_cli.py	Sun Aug 24 02:01:34 2008 +0200
@@ -16,7 +16,7 @@
 class Request(RequestBase):
     """ specialized on command line interface and script requests """
-    def __init__(self, url='CLI', pagename='', properties={}):
+    def __init__(self, url='CLI', pagename='', properties={}, given_config=None):
         self.saved_cookie = ''
         self.path_info = '/' + pagename
         self.query_string = ''
@@ -32,7 +32,7 @@
         self.content_length = None
         self.if_modified_since = None
         self.if_none_match = None
-        RequestBase.__init__(self, properties)
+        RequestBase.__init__(self, properties, given_config)
         self.cfg.caching_formats = [] # don't spoil the cache
         self.initTheme() # usually request.run() does this, but we don't use it