From e3cbfc5c5ee47660d77ccd784e7b842539a99c1c Mon Sep 17 00:00:00 2001 From: Clay Gerrard Date: Thu, 26 Feb 2015 11:45:58 -0800 Subject: [PATCH] Add tempauth back to /info Our functional tests are skipping Account ACL tests when using tempauth because it does not register itself with in swift.common.utils._swift_info Add the register_swift_info call back to the filter_factory function in the tempauth from which it was removed, and add a test to validate creating the filter will add the middleware to global info dict. Change-Id: I3761da3241601c93245796beb5d29bf3f36d69f6 --- swift/common/middleware/tempauth.py | 3 ++- test/unit/common/middleware/test_tempauth.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/swift/common/middleware/tempauth.py b/swift/common/middleware/tempauth.py index 837368fdd8..a2b07128a8 100644 --- a/swift/common/middleware/tempauth.py +++ b/swift/common/middleware/tempauth.py @@ -32,7 +32,7 @@ from swift.common.request_helpers import get_sys_meta_prefix from swift.common.middleware.acl import ( clean_acl, parse_acl, referrer_allowed, acls_from_account_info) from swift.common.utils import cache_from_env, get_logger, \ - split_path, config_true_value + split_path, config_true_value, register_swift_info from swift.common.utils import config_read_reseller_options from swift.proxy.controllers.base import get_account_info @@ -769,6 +769,7 @@ def filter_factory(global_conf, **local_conf): """Returns a WSGI filter app for use with paste.deploy.""" conf = global_conf.copy() conf.update(local_conf) + register_swift_info('tempauth', account_acls=True) def auth_filter(app): return TempAuth(app, conf) diff --git a/test/unit/common/middleware/test_tempauth.py b/test/unit/common/middleware/test_tempauth.py index df847ae28a..394668b47e 100644 --- a/test/unit/common/middleware/test_tempauth.py +++ b/test/unit/common/middleware/test_tempauth.py @@ -21,7 +21,7 @@ from time import time from swift.common.middleware import tempauth as auth from swift.common.middleware.acl import format_acl from swift.common.swob import Request, Response -from swift.common.utils import split_path +from swift.common.utils import split_path, get_swift_info NO_CONTENT_RESP = (('204 No Content', {}, ''),) # mock server response @@ -110,6 +110,10 @@ class TestAuth(unittest.TestCase): def setUp(self): self.test_auth = auth.filter_factory({})(FakeApp()) + def test_swift_info(self): + info = get_swift_info() + self.assertTrue(info['tempauth']['account_acls']) + def _make_request(self, path, **kwargs): req = Request.blank(path, **kwargs) req.environ['swift.cache'] = FakeMemcache()