summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--keystone/catalog/backends/sql.py3
-rw-r--r--keystone/catalog/core.py2
-rw-r--r--keystone/common/manager.py1
-rw-r--r--keystone/common/sql/core.py1
-rw-r--r--keystone/common/sql/migration.py1
-rw-r--r--keystone/common/utils.py1
-rw-r--r--keystone/contrib/ec2/backends/kvs.py3
-rw-r--r--keystone/contrib/ec2/backends/sql.py1
-rw-r--r--keystone/identity/backends/ldap/core.py2
-rw-r--r--keystone/identity/core.py3
-rw-r--r--keystone/middleware/auth_token.py2
-rw-r--r--keystone/openstack/common/setup.py1
-rw-r--r--keystone/test.py2
-rwxr-xr-x[-rw-r--r--]run_tests.py2
-rw-r--r--tests/_ldap_livetest.py3
-rw-r--r--tests/test_backend_ldap.py2
-rw-r--r--tests/test_backend_sql.py7
-rw-r--r--tests/test_setup.py8
-rw-r--r--tests/test_swift_auth_middleware.py3
19 files changed, 20 insertions, 28 deletions
diff --git a/keystone/catalog/backends/sql.py b/keystone/catalog/backends/sql.py
index 3c553e0c..3f9a6abf 100644
--- a/keystone/catalog/backends/sql.py
+++ b/keystone/catalog/backends/sql.py
@@ -15,9 +15,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import sqlalchemy.exc
-import webob.exc
-
from keystone import catalog
from keystone import config
from keystone import exception
diff --git a/keystone/catalog/core.py b/keystone/catalog/core.py
index 98b5ae9d..68bcae24 100644
--- a/keystone/catalog/core.py
+++ b/keystone/catalog/core.py
@@ -178,4 +178,4 @@ class EndpointController(wsgi.Application):
def delete_endpoint(self, context, endpoint_id):
self.assert_admin(context)
- endpoint_ref = self.catalog_api.delete_endpoint(context, endpoint_id)
+ self.catalog_api.delete_endpoint(context, endpoint_id)
diff --git a/keystone/common/manager.py b/keystone/common/manager.py
index 06c2ec67..18f3c41f 100644
--- a/keystone/common/manager.py
+++ b/keystone/common/manager.py
@@ -16,7 +16,6 @@
import functools
-from keystone import config
from keystone.common import utils
diff --git a/keystone/common/sql/core.py b/keystone/common/sql/core.py
index 5193e0c4..618994b0 100644
--- a/keystone/common/sql/core.py
+++ b/keystone/common/sql/core.py
@@ -19,7 +19,6 @@
import json
-import eventlet.db_pool
import sqlalchemy as sql
from sqlalchemy import types as sql_types
from sqlalchemy.exc import DisconnectionError
diff --git a/keystone/common/sql/migration.py b/keystone/common/sql/migration.py
index 616b9c91..e2b4f5ec 100644
--- a/keystone/common/sql/migration.py
+++ b/keystone/common/sql/migration.py
@@ -20,7 +20,6 @@
import os
import sys
-import sqlalchemy
from migrate.versioning import api as versioning_api
from keystone import config
diff --git a/keystone/common/utils.py b/keystone/common/utils.py
index 09ef565a..adff875a 100644
--- a/keystone/common/utils.py
+++ b/keystone/common/utils.py
@@ -198,7 +198,6 @@ def ldap_check_password(password, hashed):
if password is None:
return False
password_utf8 = trunc_password(password).encode('utf-8')
- h = passlib.hash.ldap_salted_sha1.encrypt(password_utf8)
return passlib.hash.ldap_salted_sha1.verify(password_utf8, hashed)
diff --git a/keystone/contrib/ec2/backends/kvs.py b/keystone/contrib/ec2/backends/kvs.py
index 3e967ca7..549c308e 100644
--- a/keystone/contrib/ec2/backends/kvs.py
+++ b/keystone/contrib/ec2/backends/kvs.py
@@ -37,7 +37,8 @@ class Ec2(kvs.Base):
return credential
def delete_credential(self, credential_id):
- old_credential = self.db.get('credential-%s' % credential_id)
+ # This will ensure credential-%s is here before deleting
+ self.db.get('credential-%s' % credential_id)
self.db.delete('credential-%s' % credential_id)
credential_list = set(self.db.get('credential_list', []))
credential_list.remove(credential_id)
diff --git a/keystone/contrib/ec2/backends/sql.py b/keystone/contrib/ec2/backends/sql.py
index d84c381c..c3af4648 100644
--- a/keystone/contrib/ec2/backends/sql.py
+++ b/keystone/contrib/ec2/backends/sql.py
@@ -15,7 +15,6 @@
# under the License.
from keystone.common import sql
-from keystone.common.sql import migration
class Ec2Credential(sql.ModelBase, sql.DictBase):
diff --git a/keystone/identity/backends/ldap/core.py b/keystone/identity/backends/ldap/core.py
index 7dc3bbbb..2a2c572e 100644
--- a/keystone/identity/backends/ldap/core.py
+++ b/keystone/identity/backends/ldap/core.py
@@ -100,7 +100,7 @@ class Identity(identity.Driver):
else:
metadata_ref = {}
- return (_filter_user(user_ref), tenant_ref, metadata_ref)
+ return (_filter_user(user_ref), tenant_ref, metadata_ref)
def get_tenant(self, tenant_id):
return self.tenant.get(tenant_id)
diff --git a/keystone/identity/core.py b/keystone/identity/core.py
index 6421ea26..2857f66b 100644
--- a/keystone/identity/core.py
+++ b/keystone/identity/core.py
@@ -581,7 +581,8 @@ class RoleController(wsgi.Application):
"""
self.assert_admin(context)
- user_ref = self.identity_api.get_user(context, user_id)
+ # Ensure user exists by getting it first.
+ self.identity_api.get_user(context, user_id)
tenant_ids = self.identity_api.get_tenants_for_user(context, user_id)
o = []
for tenant_id in tenant_ids:
diff --git a/keystone/middleware/auth_token.py b/keystone/middleware/auth_token.py
index 92c889d5..869c147d 100644
--- a/keystone/middleware/auth_token.py
+++ b/keystone/middleware/auth_token.py
@@ -444,7 +444,7 @@ class AuthProtocol(object):
:return wsgi env variable name (ex. 'HTTP_X_AUTH_TOKEN')
"""
- return 'HTTP_%s' % key.replace('-', '_').upper()
+ return 'HTTP_%s' % key.replace('-', '_').upper()
def _add_headers(self, env, headers):
"""Add http headers to environment."""
diff --git a/keystone/openstack/common/setup.py b/keystone/openstack/common/setup.py
index 2c16b5b3..984cce1f 100644
--- a/keystone/openstack/common/setup.py
+++ b/keystone/openstack/common/setup.py
@@ -48,7 +48,6 @@ def canonicalize_emails(changelog, mapping):
# Get requirements from the first file that exists
def get_reqs_from_files(requirements_files):
- reqs_in = []
for requirements_file in requirements_files:
if os.path.exists(requirements_file):
return open(requirements_file, 'r').read().split('\n')
diff --git a/keystone/test.py b/keystone/test.py
index 1e733ed2..5b7d66e4 100644
--- a/keystone/test.py
+++ b/keystone/test.py
@@ -80,7 +80,7 @@ def checkout_vendor(repo, rev):
# write out a modified time
with open(modcheck, 'w') as fd:
fd.write('1')
- except subprocess.CalledProcessError as e:
+ except subprocess.CalledProcessError:
LOG.warning('Failed to checkout %s', repo)
cd(working_dir)
return revdir
diff --git a/run_tests.py b/run_tests.py
index bdedecbf..9e8b6766 100644..100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -56,9 +56,7 @@ To run a single test module:
"""
-import gettext
import heapq
-import logging
import os
import unittest
import sys
diff --git a/tests/_ldap_livetest.py b/tests/_ldap_livetest.py
index df417c06..6a4420b8 100644
--- a/tests/_ldap_livetest.py
+++ b/tests/_ldap_livetest.py
@@ -15,7 +15,6 @@
# under the License.
import subprocess
-import nose.exc
from keystone import config
from keystone import test
@@ -43,7 +42,7 @@ def delete_object(name):
def clear_live_database():
roles = ['keystone_admin']
groups = ['baz', 'bar', 'tenent4add', 'fake1', 'fake2']
- users = ['foo', 'two', 'fake1', 'fake2','no_meta']
+ users = ['foo', 'two', 'fake1', 'fake2', 'no_meta']
roles = ['keystone_admin', 'useless']
for group in groups:
diff --git a/tests/test_backend_ldap.py b/tests/test_backend_ldap.py
index d225d02c..0c882b67 100644
--- a/tests/test_backend_ldap.py
+++ b/tests/test_backend_ldap.py
@@ -14,8 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import nose.exc
-
from keystone import config
from keystone import test
from keystone.common.ldap import fakeldap
diff --git a/tests/test_backend_sql.py b/tests/test_backend_sql.py
index c9644072..d600e772 100644
--- a/tests/test_backend_sql.py
+++ b/tests/test_backend_sql.py
@@ -114,7 +114,8 @@ class SqlIdentity(test.TestCase, test_backend.IdentityTests):
self.tenant_bar['id'],
{'extra': 'extra'})
self.identity_api.delete_user(user['id'])
- metadata = self.identity_api.get_metadata(user['id'], self.tenant_bar['id'])
+ metadata = self.identity_api.get_metadata(user['id'],
+ self.tenant_bar['id'])
self.assertEquals(metadata, {})
def test_delete_tenant_with_metadata(self):
@@ -126,9 +127,11 @@ class SqlIdentity(test.TestCase, test_backend.IdentityTests):
self.tenant_bar['id'],
{'extra': 'extra'})
self.identity_api.delete_tenant(self.tenant_bar['id'])
- metadata = self.identity_api.get_metadata(user['id'], self.tenant_bar['id'])
+ metadata = self.identity_api.get_metadata(user['id'],
+ self.tenant_bar['id'])
self.assertEquals(metadata, {})
+
class SqlToken(test.TestCase, test_backend.TokenTests):
def setUp(self):
super(SqlToken, self).setUp()
diff --git a/tests/test_setup.py b/tests/test_setup.py
index 0b9906dc..ff64903d 100644
--- a/tests/test_setup.py
+++ b/tests/test_setup.py
@@ -30,25 +30,25 @@ class SetupTest(unittest.TestCase):
def test_str_dict_replace(self):
string = 'Johnnie T. Hozer'
mapping = {'T.': 'The'}
- self.assertEqual('Johnnie The Hozer',
+ self.assertEqual('Johnnie The Hozer',
canonicalize_emails(string, mapping))
def test_mailmap_with_fullname(self):
with open(self.mailmap, 'w') as mm_fh:
mm_fh.write("Foo Bar <email@foo.com> Foo Bar <email@bar.com>\n")
- self.assertEqual({'<email@bar.com>' : '<email@foo.com>'},
+ self.assertEqual({'<email@bar.com>': '<email@foo.com>'},
parse_mailmap(self.mailmap))
def test_mailmap_with_firstname(self):
with open(self.mailmap, 'w') as mm_fh:
mm_fh.write("Foo <email@foo.com> Foo <email@bar.com>\n")
- self.assertEqual({'<email@bar.com>' : '<email@foo.com>'},
+ self.assertEqual({'<email@bar.com>': '<email@foo.com>'},
parse_mailmap(self.mailmap))
def test_mailmap_with_noname(self):
with open(self.mailmap, 'w') as mm_fh:
mm_fh.write("<email@foo.com> <email@bar.com>\n")
- self.assertEqual({'<email@bar.com>' : '<email@foo.com>'},
+ self.assertEqual({'<email@bar.com>': '<email@foo.com>'},
parse_mailmap(self.mailmap))
def tearDown(self):
diff --git a/tests/test_swift_auth_middleware.py b/tests/test_swift_auth_middleware.py
index ea585a76..0f47e424 100644
--- a/tests/test_swift_auth_middleware.py
+++ b/tests/test_swift_auth_middleware.py
@@ -26,6 +26,7 @@ from keystone.middleware import swift_auth
def setUpModule(self):
self.stubs = stubout.StubOutForTesting()
+
# Stub out swift_utils.get_logger. get_logger tries to configure
# syslogging to '/dev/log', which will fail on OS X.
def fake_get_logger(config, log_route=None):
@@ -156,7 +157,7 @@ class TestAuthorize(unittest.TestCase):
exception=webob.exc.HTTPForbidden)
def test_authorize_succeeds_for_reseller_admin(self):
- roles =[self.test_auth.reseller_admin_role]
+ roles = [self.test_auth.reseller_admin_role]
identity = self._get_identity(roles=roles)
req = self._check_authenticate(identity=identity)
self.assertTrue(req.environ.get('swift_owner'))