changeset 4212:1ca179133f01

Fix tests: small fixes after merge
author Florian Krupicka <florian.krupicka@googlemail.com>
date Wed, 09 Jul 2008 21:53:52 +0200
parents dde44d6e24ae
children d2c811b2716e
files MoinMoin/_tests/test_user.py MoinMoin/action/newaccount.py MoinMoin/action/sendcached.py MoinMoin/config/multiconfig.py MoinMoin/conftest.py MoinMoin/macro/_tests/test_EmbedObject.py MoinMoin/theme/__init__.py MoinMoin/web/apps.py MoinMoin/web/exceptions.py MoinMoin/web/request.py
diffstat 10 files changed, 21 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_user.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/_tests/test_user.py	Wed Jul 09 21:53:52 2008 +0200
@@ -38,11 +38,11 @@
 
     def setup_method(self, method):
         # Save original user and cookie
-        self.saved_cookie = self.request.saved_cookie
+        self.saved_cookie = self.request.cookies
         self.saved_user = self.request.user
 
         # Create anon user for the tests
-        self.request.saved_cookie = ''
+        self.request.cookies = {}
         self.request.user = user.User(self.request)
 
         # Prevent user list caching - we create and delete users too fast for that.
@@ -64,7 +64,7 @@
             del self.user
 
         # Restore original user
-        self.request.saved_cookie = self.saved_cookie
+        self.request.cookies = self.saved_cookie
         self.request.user = self.saved_user
 
         # Remove user name to id cache, or next test will fail
--- a/MoinMoin/action/newaccount.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/action/newaccount.py	Wed Jul 09 21:53:52 2008 +0200
@@ -174,7 +174,7 @@
     _ = request.getText
     form = request.form
 
-    submitted = 'create_only' in form or 'create_and_mail' in form:
+    submitted = 'create_only' in form or 'create_and_mail' in form
 
     if submitted: # user pressed create button
         request.theme.add_msg(_create_user(request), "dialog")
--- a/MoinMoin/action/sendcached.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/action/sendcached.py	Wed Jul 09 21:53:52 2008 +0200
@@ -137,7 +137,7 @@
 def get_url(request, key):
     """ get URL for the object cached for key """
     return "%s/?%s" % (
-        request.getScriptname(),
+        request.script_root,
         wikiutil.makeQueryString(dict(action=action_name, key=key), want_unicode=False))
 
 
--- a/MoinMoin/config/multiconfig.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/config/multiconfig.py	Wed Jul 09 21:53:52 2008 +0200
@@ -16,7 +16,7 @@
 from MoinMoin import log
 logging = log.getLogger(__name__)
 
-from MoinMoin import config, error, util, wikiutil
+from MoinMoin import config, error, util, wikiutil, web
 from MoinMoin.auth import MoinAuth
 import MoinMoin.auth as authmodule
 import MoinMoin.events as events
@@ -24,10 +24,10 @@
 from MoinMoin.events import PageDeletedEvent, PageCopiedEvent
 from MoinMoin.events import PageRevertedEvent, FileAttachedEvent
 from MoinMoin import session
+import MoinMoin.web.session
 from MoinMoin.packages import packLine
 from MoinMoin.security import AccessControlList
 from MoinMoin.support.python_compatibility import set
-from MoinMoin.web.session import FileSessionService
 
 _url_re_cache = None
 _farmconfig_mtime = None
@@ -654,6 +654,8 @@
      "See HelpOnSessions."),
     ('session_id_handler', DefaultExpression('session.MoinCookieSessionIDHandler()'),
      "Only used by the DefaultSessionHandler, see HelpOnSessions."),
+    ('session_service', DefaultExpression('web.session.FileSessionService()'),
+     "New session service (used by the new WSGI layer)"),
     ('cookie_domain', None,
      'Domain used in the session cookie. (None = do not specify domain).'),
     ('cookie_path', None,
--- a/MoinMoin/conftest.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/conftest.py	Wed Jul 09 21:53:52 2008 +0200
@@ -36,6 +36,8 @@
 sys.path.insert(0, str(moindir.join("tests")))
 
 from MoinMoin.support.python_compatibility import set
+from MoinMoin.web.request import TestRequest
+from MoinMoin.wsgiapp import init as request_init
 
 coverage_modules = set()
 
@@ -71,12 +73,10 @@
 
 
 def init_test_request(static_state=[False]):
-    from MoinMoin.web.request import create_request
-    from MoinMoin.wsgiapp import init as request_init
     if not static_state[0]:
         maketestwiki.run(True)
         static_state[0] = True
-    request = create_request()
+    request = TestRequest()
     request = request_init(request)
     return request
 
--- a/MoinMoin/macro/_tests/test_EmbedObject.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/macro/_tests/test_EmbedObject.py	Wed Jul 09 21:53:52 2008 +0200
@@ -70,8 +70,7 @@
         m = self._make_macro()
         filename = 'test.mpg'
         result = m.execute('EmbedObject', u'%s' % filename)
-        assert '<object data="./AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=get&amp;target=test.mpg"' in result
-        assert '<object data="/AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=get&amp;target=test.ogg"' in result
+        assert '<object data="/AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=get&amp;target=test.mpg"' in result
         assert 'align="middle"' in result
         assert 'value="transparent"' in result
 
@@ -81,8 +80,7 @@
         filename = 'test.mpg'
         height = '50 %' # also tests that space is allowed in there
         result = m.execute('EmbedObject', u'target=%s, height=%s' % (filename, height))
-        assert '<object data="./AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=get&amp;target=test.mpg"' in result
-        assert '<object data="/AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=get&amp;target=test.ogg"' in result
+        assert '<object data="/AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=get&amp;target=test.mpg"' in result
         assert 'height="50%"' in result
         assert 'align="middle"' in result
 
--- a/MoinMoin/theme/__init__.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/theme/__init__.py	Wed Jul 09 21:53:52 2008 +0200
@@ -1826,7 +1826,7 @@
     """
     if theme_name is None or theme_name == '<default>':
         theme_name = request.cfg.theme_default
-        
+
     try:
         Theme = wikiutil.importPlugin(request.cfg, 'theme', theme_name, 'Theme')
     except wikiutil.PluginMissingError:
@@ -1843,7 +1843,7 @@
     @rtype: int
     @return: A statuscode for how successful the loading was
              0 - theme was loaded
-             1 - fallback to default theme 
+             1 - fallback to default theme
              2 - serious fallback to builtin theme
     """
     fallback = 0
--- a/MoinMoin/web/apps.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/web/apps.py	Wed Jul 09 21:53:52 2008 +0200
@@ -23,14 +23,14 @@
 
 class XMLRPCApp(object):
     """ Handles XML-RPC method calls or dispatches to next layer """
-    
+
     def __init__(self, app):
         self.app = app
-        
+
     def __call__(self, environ, start_response):
         request = Request(environ)
         action = request.args.get('action')
-        
+
         from MoinMoin import xmlrpc
 
         if action == 'xmlrpc':
--- a/MoinMoin/web/exceptions.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/web/exceptions.py	Wed Jul 09 21:53:52 2008 +0200
@@ -16,7 +16,7 @@
         "<p>Please make a short break reading the stuff you already got.</p>"
         "<p>When you restart doing requests AFTER that, slow down or you might get locked out for a longer time!</p>"
     )
-    
+
     def __init__(self, description=None, retry_after=3600):
         exceptions.ServiceUnavailable.__init__(self, description)
         self.retry_after = retry_after
--- a/MoinMoin/web/request.py	Wed Jul 09 21:48:04 2008 +0200
+++ b/MoinMoin/web/request.py	Wed Jul 09 21:53:52 2008 +0200
@@ -78,7 +78,7 @@
                                  content_length=content_length,
                                  errors_stream=self.errors_stream)
 
-        for k,v in env.items():
+        for k, v in env.items():
             environ[k] = v
 
         environ['HTTP_USER_AGENT'] = 'MoinMoin/TestRequest'