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
This commit is contained in:
Clay Gerrard 2015-02-26 11:45:58 -08:00
parent a14cf43c47
commit e3cbfc5c5e
2 changed files with 7 additions and 2 deletions

View File

@ -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)

View File

@ -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()