diff --git a/ckan/tests/pylons_controller.py b/ckan/tests/pylons_controller.py index d3ac911b2c5..b23b93cf866 100644 --- a/ckan/tests/pylons_controller.py +++ b/ckan/tests/pylons_controller.py @@ -17,10 +17,13 @@ from ckan.tests import * from ckan.lib.cli import MockTranslator -class TestSession(dict): +class TestPylonsSession(dict): + last_accessed = None + def save(self): pass + class PylonsTestCase(object): """A basic test case which allows access to pylons.c and pylons.request. """ @@ -35,7 +38,7 @@ def setup_class(cls): cls.app_globals_obj = app_globals.Globals() cls.registry.register(pylons.g, cls.app_globals_obj) - cls.request_obj=Request(dict(HTTP_HOST="nohost")) + cls.request_obj=Request(dict(HTTP_HOST="nohost", REQUEST_METHOD="GET")) cls.registry.register(pylons.request, cls.request_obj) cls.translator_obj=MockTranslator() @@ -47,7 +50,7 @@ def setup_class(cls): cls.registry.register(pylons.response, Response()) mapper = make_map() cls.registry.register(pylons.url, URLGenerator(mapper, {})) - cls.registry.register(pylons.session, TestSession()) + cls.registry.register(pylons.session, TestPylonsSession()) # Templates often want to find out the request's routes info, so put # some dummy values into the routes_dict, so the templates that do @@ -56,6 +59,7 @@ def setup_class(cls): 'action': 'test-action', 'controller': 'test-package::', }}) + pylons.c.environ = pylons.request.environ @classmethod def teardown_class(cls):