Spring cleaning, fix PEP8 violations.
Change-Id: Ide832cd64c9b285213e23901eaf81946d504e726
This commit is contained in:
parent
5ea232a09f
commit
3a296a458c
@ -3,7 +3,8 @@
|
||||
# keystone documentation build configuration file, created by
|
||||
# sphinx-quickstart on Mon Jan 9 12:02:59 2012.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
@ -19,14 +20,17 @@ import os
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
# -- General configuration
|
||||
# -- -----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
#extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage']
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
#extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
|
||||
# 'sphinx.ext.todo', 'sphinx.ext.coverage']
|
||||
extensions = ['sphinx.ext.autodoc',
|
||||
'sphinx.ext.todo',
|
||||
# 'sphinx.ect.intersphinx',
|
||||
@ -77,7 +81,8 @@ release = '2012.1-dev'
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = []
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
@ -110,7 +115,7 @@ man_pages = [
|
||||
]
|
||||
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
# -- Options for HTML output
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
@ -193,7 +198,7 @@ html_last_updated_fmt = os.popen(git_cmd).read()
|
||||
htmlhelp_basename = 'keystonedoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
# -- Options for LaTeX output
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
@ -206,8 +211,9 @@ latex_elements = {
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
# Grouping the document tree into LaTeX files. List of tuples (source
|
||||
# start file, target name, title, author, documentclass
|
||||
# [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'keystone.tex', u'Keystone Documentation',
|
||||
u'OpenStack', 'manual'),
|
||||
@ -234,20 +240,19 @@ latex_documents = [
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output --------------------------------------------
|
||||
# -- Options for manual page output
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'keystone', u'Keystone Documentation',
|
||||
[u'OpenStack'], 1)
|
||||
]
|
||||
[u'OpenStack'], 1)]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output ------------------------------------------------
|
||||
# -- Options for Texinfo output
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
|
1
run_tests.py
Normal file → Executable file
1
run_tests.py
Normal file → Executable file
@ -69,7 +69,6 @@ from nose import core
|
||||
from nose import result
|
||||
|
||||
|
||||
|
||||
class _AnsiColorizer(object):
|
||||
"""
|
||||
A colorizer is an object that loosely wraps around a stream, allowing
|
||||
|
@ -22,12 +22,12 @@ TENANTS = [
|
||||
|
||||
# NOTE(ja): a role of keystone_admin and attribute "is_admin" is done in setUp
|
||||
USERS = [
|
||||
{'id': 'foo', 'name': 'FOO', 'password': 'foo2', 'tenants': ['bar',]},
|
||||
{'id': 'two', 'name': 'TWO', 'password': 'two2', 'tenants': ['baz',]},
|
||||
{'id': 'foo', 'name': 'FOO', 'password': 'foo2', 'tenants': ['bar']},
|
||||
{'id': 'two', 'name': 'TWO', 'password': 'two2', 'tenants': ['baz']},
|
||||
{'id': 'no_meta',
|
||||
'name': 'NO_META',
|
||||
'password': 'no_meta2',
|
||||
'tenants': ['baz',]},
|
||||
'tenants': ['baz']},
|
||||
]
|
||||
|
||||
METADATA = [
|
||||
|
@ -169,10 +169,9 @@ class FakeHTTPConnection(object):
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
class FakeApp(object):
|
||||
"""This represents a WSGI app protected by the auth_token middleware.
|
||||
|
||||
"""
|
||||
class FakeApp(object):
|
||||
"""This represents a WSGI app protected by the auth_token middleware."""
|
||||
def __init__(self, expected_env=None):
|
||||
expected_env = expected_env or {}
|
||||
self.expected_env = {
|
||||
@ -238,6 +237,7 @@ class DiabloAuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
|
||||
self.assertEqual(self.response_status, 200)
|
||||
self.assertEqual(body, ['SUCCESS'])
|
||||
|
||||
|
||||
class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
|
||||
def test_valid_request(self):
|
||||
req = webob.Request.blank('/')
|
||||
|
@ -46,9 +46,9 @@ class IdentityTests(object):
|
||||
user_ref, tenant_ref, metadata_ref = self.identity_api.authenticate(
|
||||
user_id=self.user_foo['id'],
|
||||
password=self.user_foo['password'])
|
||||
# NOTE(termie): the password field is left in user_foo to make it easier
|
||||
# to authenticate in tests, but should not be returned by
|
||||
# the api
|
||||
# NOTE(termie): the password field is left in user_foo to make
|
||||
# it easier to authenticate in tests, but should
|
||||
# not be returned by the api
|
||||
self.user_foo.pop('password')
|
||||
self.assertDictEquals(user_ref, self.user_foo)
|
||||
self.assert_(tenant_ref is None)
|
||||
@ -59,9 +59,9 @@ class IdentityTests(object):
|
||||
user_id=self.user_foo['id'],
|
||||
tenant_id=self.tenant_bar['id'],
|
||||
password=self.user_foo['password'])
|
||||
# NOTE(termie): the password field is left in user_foo to make it easier
|
||||
# to authenticate in tests, but should not be returned by
|
||||
# the api
|
||||
# NOTE(termie): the password field is left in user_foo to make
|
||||
# it easier to authenticate in tests, but should
|
||||
# not be returned by the api
|
||||
self.user_foo.pop('password')
|
||||
self.assertDictEquals(user_ref, self.user_foo)
|
||||
self.assertDictEquals(tenant_ref, self.tenant_bar)
|
||||
@ -74,9 +74,9 @@ class IdentityTests(object):
|
||||
user_id=user['id'],
|
||||
tenant_id=tenant['id'],
|
||||
password=user['password'])
|
||||
# NOTE(termie): the password field is left in user_foo to make it easier
|
||||
# to authenticate in tests, but should not be returned by
|
||||
# the api
|
||||
# NOTE(termie): the password field is left in user_foo to make
|
||||
# it easier to authenticate in tests, but should
|
||||
# not be returned by the api
|
||||
user.pop('password')
|
||||
self.assertEquals(metadata_ref, {})
|
||||
self.assertDictEquals(user_ref, user)
|
||||
@ -113,18 +113,18 @@ class IdentityTests(object):
|
||||
|
||||
def test_get_user(self):
|
||||
user_ref = self.identity_api.get_user(user_id=self.user_foo['id'])
|
||||
# NOTE(termie): the password field is left in user_foo to make it easier
|
||||
# to authenticate in tests, but should not be returned by
|
||||
# the api
|
||||
# NOTE(termie): the password field is left in user_foo to make
|
||||
# it easier to authenticate in tests, but should
|
||||
# not be returned by the api
|
||||
self.user_foo.pop('password')
|
||||
self.assertDictEquals(user_ref, self.user_foo)
|
||||
|
||||
def test_get_user_by_name(self):
|
||||
user_ref = self.identity_api.get_user_by_name(
|
||||
user_name=self.user_foo['name'])
|
||||
# NOTE(termie): the password field is left in user_foo to make it easier
|
||||
# to authenticate in tests, but should not be returned by
|
||||
# the api
|
||||
# NOTE(termie): the password field is left in user_foo to make
|
||||
# it easier to authenticate in tests, but should
|
||||
# not be returned by the api
|
||||
self.user_foo.pop('password')
|
||||
self.assertDictEquals(user_ref, self.user_foo)
|
||||
|
||||
@ -155,7 +155,7 @@ class IdentityTests(object):
|
||||
user = {'id': 'fake1',
|
||||
'name': 'fake1',
|
||||
'password': 'fakepass',
|
||||
'tenants': ['bar',]}
|
||||
'tenants': ['bar']}
|
||||
self.identity_api.create_user('fake1', user)
|
||||
user['name'] = 'fake2'
|
||||
self.assertRaises(Exception,
|
||||
@ -167,7 +167,7 @@ class IdentityTests(object):
|
||||
user = {'id': 'fake1',
|
||||
'name': 'fake1',
|
||||
'password': 'fakepass',
|
||||
'tenants': ['bar',]}
|
||||
'tenants': ['bar']}
|
||||
self.identity_api.create_user('fake1', user)
|
||||
user['id'] = 'fake2'
|
||||
self.assertRaises(Exception,
|
||||
@ -179,11 +179,11 @@ class IdentityTests(object):
|
||||
user1 = {'id': 'fake1',
|
||||
'name': 'fake1',
|
||||
'password': 'fakepass',
|
||||
'tenants': ['bar',]}
|
||||
'tenants': ['bar']}
|
||||
user2 = {'id': 'fake2',
|
||||
'name': 'fake2',
|
||||
'password': 'fakepass',
|
||||
'tenants': ['bar',]}
|
||||
'tenants': ['bar']}
|
||||
self.identity_api.create_user('fake1', user1)
|
||||
self.identity_api.create_user('fake2', user2)
|
||||
user2['name'] = 'fake1'
|
||||
@ -196,7 +196,7 @@ class IdentityTests(object):
|
||||
user = {'id': 'fake1',
|
||||
'name': 'fake1',
|
||||
'password': 'fakepass',
|
||||
'tenants': ['bar',]}
|
||||
'tenants': ['bar']}
|
||||
self.identity_api.create_user('fake1', user)
|
||||
user['id'] = 'fake2'
|
||||
self.identity_api.update_user('fake1', user)
|
||||
@ -244,29 +244,28 @@ class IdentityTests(object):
|
||||
tenant_ref = self.identity_api.get_tenant('fake2')
|
||||
self.assert_(tenant_ref is None)
|
||||
|
||||
|
||||
def test_get_role_by_user_and_tenant(self):
|
||||
roles_ref = self.identity_api.get_roles_for_user_and_tenant(
|
||||
self.user_foo['id'],self.tenant_bar['id'])
|
||||
self.user_foo['id'], self.tenant_bar['id'])
|
||||
self.assertNotIn('keystone_admin', roles_ref)
|
||||
self.identity_api.add_role_to_user_and_tenant(
|
||||
self.user_foo['id'],self.tenant_bar['id'], 'keystone_admin')
|
||||
self.user_foo['id'], self.tenant_bar['id'], 'keystone_admin')
|
||||
roles_ref = self.identity_api.get_roles_for_user_and_tenant(
|
||||
self.user_foo['id'],self.tenant_bar['id'])
|
||||
self.user_foo['id'], self.tenant_bar['id'])
|
||||
self.assertIn('keystone_admin', roles_ref)
|
||||
self.assertNotIn('useless',roles_ref)
|
||||
self.assertNotIn('useless', roles_ref)
|
||||
|
||||
self.identity_api.add_role_to_user_and_tenant(
|
||||
self.user_foo['id'],self.tenant_bar['id'], 'useless')
|
||||
self.user_foo['id'], self.tenant_bar['id'], 'useless')
|
||||
roles_ref = self.identity_api.get_roles_for_user_and_tenant(
|
||||
self.user_foo['id'],self.tenant_bar['id'])
|
||||
self.user_foo['id'], self.tenant_bar['id'])
|
||||
self.assertIn('keystone_admin', roles_ref)
|
||||
self.assertIn('useless',roles_ref)
|
||||
self.assertIn('useless', roles_ref)
|
||||
|
||||
def test_delete_role(self):
|
||||
role_id = 'test_role_delete'
|
||||
new_role = {'id': role_id, 'name': 'Role to Delete'}
|
||||
self.identity_api.create_role(role_id , new_role)
|
||||
self.identity_api.create_role(role_id, new_role)
|
||||
role_ref = self.identity_api.get_role(role_id)
|
||||
self.assertDictEquals(role_ref, new_role)
|
||||
self.identity_api.delete_role(role_id)
|
||||
@ -277,7 +276,7 @@ class IdentityTests(object):
|
||||
def test_add_user_to_tenant(self):
|
||||
tenant_id = 'tenent4add'
|
||||
self.identity_api.add_user_to_tenant(tenant_id, 'foo')
|
||||
tenants = self.identity_api.get_tenants_for_user('foo')
|
||||
tenants = self.identity_api.get_tenants_for_user('foo')
|
||||
self.assertIn(tenant_id, tenants)
|
||||
|
||||
|
||||
@ -303,7 +302,7 @@ class TokenTests(object):
|
||||
|
||||
def test_expired_token(self):
|
||||
token_id = uuid.uuid4().hex
|
||||
expire_time = datetime.datetime.now() - datetime.timedelta(minutes=1)
|
||||
expire_time = datetime.datetime.now() - datetime.timedelta(minutes=1)
|
||||
data = {'id': token_id, 'a': 'b', 'expires': expire_time}
|
||||
data_ref = self.token_api.create_token(token_id, data)
|
||||
self.assertDictEquals(data_ref, data)
|
||||
|
@ -23,38 +23,38 @@ import default_fixtures
|
||||
|
||||
|
||||
class KvsIdentity(test.TestCase, test_backend.IdentityTests):
|
||||
def setUp(self):
|
||||
super(KvsIdentity, self).setUp()
|
||||
self.identity_api = identity_kvs.Identity(db={})
|
||||
self.load_fixtures(default_fixtures)
|
||||
def setUp(self):
|
||||
super(KvsIdentity, self).setUp()
|
||||
self.identity_api = identity_kvs.Identity(db={})
|
||||
self.load_fixtures(default_fixtures)
|
||||
|
||||
|
||||
class KvsToken(test.TestCase, test_backend.TokenTests):
|
||||
def setUp(self):
|
||||
super(KvsToken, self).setUp()
|
||||
self.token_api = token_kvs.Token(db={})
|
||||
def setUp(self):
|
||||
super(KvsToken, self).setUp()
|
||||
self.token_api = token_kvs.Token(db={})
|
||||
|
||||
|
||||
class KvsCatalog(test.TestCase, test_backend.CatalogTests):
|
||||
def setUp(self):
|
||||
super(KvsCatalog, self).setUp()
|
||||
self.catalog_api = catalog_kvs.Catalog(db={})
|
||||
self.load_fixtures(default_fixtures)
|
||||
self._load_fake_catalog()
|
||||
def setUp(self):
|
||||
super(KvsCatalog, self).setUp()
|
||||
self.catalog_api = catalog_kvs.Catalog(db={})
|
||||
self.load_fixtures(default_fixtures)
|
||||
self._load_fake_catalog()
|
||||
|
||||
def _load_fake_catalog(self):
|
||||
self.catalog_foobar = self.catalog_api._create_catalog(
|
||||
'foo', 'bar',
|
||||
{'RegionFoo': {'service_bar': {'foo': 'bar'}}})
|
||||
def _load_fake_catalog(self):
|
||||
self.catalog_foobar = self.catalog_api._create_catalog(
|
||||
'foo', 'bar',
|
||||
{'RegionFoo': {'service_bar': {'foo': 'bar'}}})
|
||||
|
||||
def test_get_catalog_bad_user(self):
|
||||
catalog_ref = self.catalog_api.get_catalog('foo' + 'WRONG', 'bar')
|
||||
self.assert_(catalog_ref is None)
|
||||
def test_get_catalog_bad_user(self):
|
||||
catalog_ref = self.catalog_api.get_catalog('foo' + 'WRONG', 'bar')
|
||||
self.assert_(catalog_ref is None)
|
||||
|
||||
def test_get_catalog_bad_tenant(self):
|
||||
catalog_ref = self.catalog_api.get_catalog('foo', 'bar' + 'WRONG')
|
||||
self.assert_(catalog_ref is None)
|
||||
def test_get_catalog_bad_tenant(self):
|
||||
catalog_ref = self.catalog_api.get_catalog('foo', 'bar' + 'WRONG')
|
||||
self.assert_(catalog_ref is None)
|
||||
|
||||
def test_get_catalog(self):
|
||||
catalog_ref = self.catalog_api.get_catalog('foo', 'bar')
|
||||
self.assertDictEquals(catalog_ref, self.catalog_foobar)
|
||||
def test_get_catalog(self):
|
||||
catalog_ref = self.catalog_api.get_catalog('foo', 'bar')
|
||||
self.assertDictEquals(catalog_ref, self.catalog_foobar)
|
||||
|
@ -28,24 +28,24 @@ CONF = config.CONF
|
||||
|
||||
|
||||
class SqlIdentity(test.TestCase, test_backend.IdentityTests):
|
||||
def setUp(self):
|
||||
super(SqlIdentity, self).setUp()
|
||||
CONF(config_files=[test.etcdir('keystone.conf'),
|
||||
test.testsdir('test_overrides.conf'),
|
||||
test.testsdir('backend_sql.conf')])
|
||||
sql_util.setup_test_database()
|
||||
self.identity_api = identity_sql.Identity()
|
||||
self.load_fixtures(default_fixtures)
|
||||
def setUp(self):
|
||||
super(SqlIdentity, self).setUp()
|
||||
CONF(config_files=[test.etcdir('keystone.conf'),
|
||||
test.testsdir('test_overrides.conf'),
|
||||
test.testsdir('backend_sql.conf')])
|
||||
sql_util.setup_test_database()
|
||||
self.identity_api = identity_sql.Identity()
|
||||
self.load_fixtures(default_fixtures)
|
||||
|
||||
|
||||
class SqlToken(test.TestCase, test_backend.TokenTests):
|
||||
def setUp(self):
|
||||
super(SqlToken, self).setUp()
|
||||
CONF(config_files=[test.etcdir('keystone.conf'),
|
||||
test.testsdir('test_overrides.conf'),
|
||||
test.testsdir('backend_sql.conf')])
|
||||
sql_util.setup_test_database()
|
||||
self.token_api = token_sql.Token()
|
||||
def setUp(self):
|
||||
super(SqlToken, self).setUp()
|
||||
CONF(config_files=[test.etcdir('keystone.conf'),
|
||||
test.testsdir('test_overrides.conf'),
|
||||
test.testsdir('backend_sql.conf')])
|
||||
sql_util.setup_test_database()
|
||||
self.token_api = token_sql.Token()
|
||||
|
||||
|
||||
#class SqlCatalog(test_backend_kvs.KvsCatalog):
|
||||
|
@ -368,9 +368,9 @@ class CoreApiTests(object):
|
||||
|
||||
def test_validate_token_belongs_to(self):
|
||||
token = self.get_scoped_token()
|
||||
path = ('/v2.0/tokens/%s?belongsTo=%s'
|
||||
% (token, self.tenant_bar['id']))
|
||||
r = self.admin_request(path=path,token=token)
|
||||
path = ('/v2.0/tokens/%s?belongsTo=%s' % (token,
|
||||
self.tenant_bar['id']))
|
||||
r = self.admin_request(path=path, token=token)
|
||||
self.assertValidAuthenticationResponse(r,
|
||||
require_service_catalog=True)
|
||||
|
||||
|
@ -24,11 +24,9 @@ from keystone import test
|
||||
from keystone.common.sql import legacy
|
||||
from keystone.common.sql import util as sql_util
|
||||
from keystone.identity.backends import sql as identity_sql
|
||||
from keystone.token.backends import sql as token_sql
|
||||
from keystone.catalog.backends import templated as catalog_templated
|
||||
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
|
@ -510,7 +510,8 @@ class KcMasterTestCase(CompatTestCase, KeystoneClientTests):
|
||||
tenant_id = uuid.uuid4().hex
|
||||
tenant = {'name': 'tenant-%s' % tenant_id, 'id': tenant_id}
|
||||
self.identity_api.create_tenant(tenant_id, tenant)
|
||||
self.identity_api.add_user_to_tenant(tenant_id, self.user_foo['id'])
|
||||
self.identity_api.add_user_to_tenant(tenant_id,
|
||||
self.user_foo['id'])
|
||||
|
||||
tenants = client.tenants.list()
|
||||
self.assertEqual(len(tenants), 3)
|
||||
@ -535,7 +536,8 @@ class KcMasterTestCase(CompatTestCase, KeystoneClientTests):
|
||||
tenant_id = uuid.uuid4().hex
|
||||
tenant = {'name': 'tenant-%s' % tenant_id, 'id': tenant_id}
|
||||
self.identity_api.create_tenant(tenant_id, tenant)
|
||||
self.identity_api.add_user_to_tenant(tenant_id, self.user_foo['id'])
|
||||
self.identity_api.add_user_to_tenant(tenant_id,
|
||||
self.user_foo['id'])
|
||||
|
||||
tenants = client.tenants.list()
|
||||
self.assertEqual(len(tenants), 3)
|
||||
|
@ -95,7 +95,8 @@ class JsonBodyMiddlewareTest(test.TestCase):
|
||||
_middleware.process_request, req)
|
||||
|
||||
def test_no_content_type(self):
|
||||
req = make_request(body='{"arg1": "one", "arg2": ["a"]}', method='POST')
|
||||
req = make_request(body='{"arg1": "one", "arg2": ["a"]}',
|
||||
method='POST')
|
||||
middleware.JsonBodyMiddleware(None).process_request(req)
|
||||
params = req.environ[middleware.PARAMS_ENV]
|
||||
self.assertEqual(params, {"arg1": "one", "arg2": ["a"]})
|
||||
|
Loading…
Reference in New Issue
Block a user