Merge "Fix and enable gating on H403"

This commit is contained in:
Jenkins
2013-07-17 16:08:35 +00:00
committed by Gerrit Code Review
8 changed files with 17 additions and 10 deletions

View File

@@ -19,7 +19,8 @@ class AuthorizationFailure(Exception):
class NoTokenLookupException(Exception): class NoTokenLookupException(Exception):
"""This form of authentication does not support looking up """This form of authentication does not support looking up
endpoints from an existing token.""" endpoints from an existing token.
"""
pass pass

View File

@@ -57,7 +57,8 @@ class Client(object):
def get(self, key): def get(self, key):
"""Retrieves the value for a key or None. """Retrieves the value for a key or None.
this expunges expired keys during each get""" this expunges expired keys during each get
"""
now = timeutils.utcnow_ts() now = timeutils.utcnow_ts()
for k in self.cache.keys(): for k in self.cache.keys():

View File

@@ -141,7 +141,8 @@ def clear_time_override():
def marshall_now(now=None): def marshall_now(now=None):
"""Make an rpc-safe datetime with microseconds. """Make an rpc-safe datetime with microseconds.
Note: tzinfo is stripped, but not required for relative times.""" Note: tzinfo is stripped, but not required for relative times.
"""
if not now: if not now:
now = utcnow() now = utcnow()
return dict(day=now.day, month=now.month, year=now.year, hour=now.hour, return dict(day=now.day, month=now.month, year=now.year, hour=now.hour,

View File

@@ -93,7 +93,8 @@ class ServiceCatalog(object):
class ServiceCatalogV2(ServiceCatalog): class ServiceCatalogV2(ServiceCatalog):
"""An object for encapsulating the service catalog using raw v2 auth token """An object for encapsulating the service catalog using raw v2 auth token
from Keystone.""" from Keystone.
"""
def __init__(self, resource_dict, region_name=None): def __init__(self, resource_dict, region_name=None):
self.catalog = resource_dict self.catalog = resource_dict
@@ -179,7 +180,8 @@ class ServiceCatalogV2(ServiceCatalog):
class ServiceCatalogV3(ServiceCatalog): class ServiceCatalogV3(ServiceCatalog):
"""An object for encapsulating the service catalog using raw v3 auth token """An object for encapsulating the service catalog using raw v3 auth token
from Keystone.""" from Keystone.
"""
def __init__(self, token, resource_dict, region_name=None): def __init__(self, token, resource_dict, region_name=None):
self._auth_token = token self._auth_token = token

View File

@@ -197,7 +197,8 @@ class Client(client.HTTPClient):
"""Takes a username, password, and optionally a tenant_id or """Takes a username, password, and optionally a tenant_id or
tenant_name to get an authentication token from keystone. tenant_name to get an authentication token from keystone.
May also take a token and a tenant_id to re-scope a token May also take a token and a tenant_id to re-scope a token
to a tenant.""" to a tenant.
"""
headers = {} headers = {}
url = auth_url + "/tokens" url = auth_url + "/tokens"
if token: if token:

View File

@@ -699,7 +699,8 @@ if tuple(sys.version_info)[0:2] < (2, 7):
class AdjustedBaseAuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest): class AdjustedBaseAuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
def assertIsInstance(self, obj, cls, msg=None): def assertIsInstance(self, obj, cls, msg=None):
"""Same as self.assertTrue(isinstance(obj, cls)), with a nicer """Same as self.assertTrue(isinstance(obj, cls)), with a nicer
default message.""" default message.
"""
if not isinstance(obj, cls): if not isinstance(obj, cls):
standardMsg = '%s is not an instance of %r' % (obj, cls) standardMsg = '%s is not an instance of %r' % (obj, cls)
self.fail(self._formatMessage(msg, standardMsg)) self.fail(self._formatMessage(msg, standardMsg))

View File

@@ -293,7 +293,8 @@ class ShellTest(utils.TestCase):
def test_shell_tenant_id_args(self): def test_shell_tenant_id_args(self):
"""Test a corner case where --tenant_id appears on the """Test a corner case where --tenant_id appears on the
command-line twice""" command-line twice.
"""
do_ec2_mock = mock.MagicMock() do_ec2_mock = mock.MagicMock()
# grab the decorators for do_ec2_create_credentials # grab the decorators for do_ec2_create_credentials
ec2_func = getattr(shell_v2_0, 'do_ec2_credentials_create') ec2_func = getattr(shell_v2_0, 'do_ec2_credentials_create')

View File

@@ -35,9 +35,8 @@ downloadcache = ~/cache/pip
# H302: import only modules # H302: import only modules
# H304: no relative imports # H304: no relative imports
# H306: imports not in alphabetical order # H306: imports not in alphabetical order
# H403: multi line docstring end on new line
# H404: multi line docstring should start with a summary # H404: multi line docstring should start with a summary
# H802: git commit title # H802: git commit title
ignore = F811,F821,F841,H201,H202,H302,H304,H306,H403,H404,H802 ignore = F811,F821,F841,H201,H202,H302,H304,H306,H404,H802
show-source = True show-source = True
exclude = .venv,.tox,dist,doc,*egg,build exclude = .venv,.tox,dist,doc,*egg,build