summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-06-23 16:47:47 +0000
committerGerrit Code Review <review@openstack.org>2013-06-23 16:47:47 +0000
commit665058f47c22ec154657cfbff56a8da12ff7a18e (patch)
tree525fb40c9a607932ac2fbe022f234df61bad48be
parentbc063e554fef542e935fbc76c14e2228ce5c9e58 (diff)
parenta48488764a38961a66ad07c4bf629f220f80334c (diff)
Merge "wsgi.Middleware factory should use **kwargs"
-rw-r--r--keystone/common/wsgi.py2
-rw-r--r--tests/test_wsgi.py10
2 files changed, 11 insertions, 1 deletions
diff --git a/keystone/common/wsgi.py b/keystone/common/wsgi.py
index d5368b2a..8f76b24f 100644
--- a/keystone/common/wsgi.py
+++ b/keystone/common/wsgi.py
@@ -288,7 +288,7 @@ class Middleware(Application):
def _factory(app):
conf = global_config.copy()
conf.update(local_config)
- return cls(app)
+ return cls(app, **local_config)
return _factory
def __init__(self, application):
diff --git a/tests/test_wsgi.py b/tests/test_wsgi.py
index 8e266749..c73212c8 100644
--- a/tests/test_wsgi.py
+++ b/tests/test_wsgi.py
@@ -176,3 +176,13 @@ class MiddlewareTest(BaseWSGITest):
resp = FakeMiddleware(self.app)(req)
self.assertEquals(resp.status_int, exception.UnexpectedError.code)
self.assertIn("EXCEPTIONERROR", resp.body)
+
+ def test_middleware_local_config(self):
+ class FakeMiddleware(wsgi.Middleware):
+ def __init__(self, *args, **kwargs):
+ self.kwargs = kwargs
+
+ factory = FakeMiddleware.factory({}, testkey="test")
+ app = factory(self.app)
+ self.assertIn("testkey", app.kwargs)
+ self.assertEquals("test", app.kwargs["testkey"])