Skip to content

Commit

Permalink
wsgi.Middleware factory should use **kwargs
Browse files Browse the repository at this point in the history
Fixes bug 1190978

Change-Id: Ifb0673b7aab5292c13bf5c86c5cc2de8096f7e3e
  • Loading branch information
alvarolopez authored and openstack-gerrit committed Jun 20, 2013
1 parent 7ccfac7 commit a484887
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion keystone/common/wsgi.py
Expand Up @@ -288,7 +288,7 @@ def factory(cls, global_config, **local_config):
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):
Expand Down
10 changes: 10 additions & 0 deletions tests/test_wsgi.py
Expand Up @@ -176,3 +176,13 @@ def process_response(self, request, response):
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"])

0 comments on commit a484887

Please sign in to comment.