summaryrefslogtreecommitdiff
path: root/keystone/tests
diff options
context:
space:
mode:
Diffstat (limited to 'keystone/tests')
-rw-r--r--keystone/tests/hacking/checks.py1
-rw-r--r--keystone/tests/unit/backend/domain_config/core.py6
-rw-r--r--keystone/tests/unit/common/test_notifications.py1
-rw-r--r--keystone/tests/unit/contrib/federation/test_utils.py12
-rw-r--r--keystone/tests/unit/core.py1
-rw-r--r--keystone/tests/unit/fakeldap.py1
-rw-r--r--keystone/tests/unit/filtering.py3
-rw-r--r--keystone/tests/unit/identity_mapping.py1
-rw-r--r--keystone/tests/unit/test_backend.py15
-rw-r--r--keystone/tests/unit/test_backend_endpoint_policy.py1
-rw-r--r--keystone/tests/unit/test_backend_ldap.py9
-rw-r--r--keystone/tests/unit/test_backend_sql.py1
-rw-r--r--keystone/tests/unit/test_revoke.py1
-rw-r--r--keystone/tests/unit/test_sql_upgrade.py3
-rw-r--r--keystone/tests/unit/test_v2.py2
-rw-r--r--keystone/tests/unit/test_v2_controller.py1
-rw-r--r--keystone/tests/unit/test_v3.py4
-rw-r--r--keystone/tests/unit/test_v3_assignment.py18
-rw-r--r--keystone/tests/unit/test_v3_auth.py6
-rw-r--r--keystone/tests/unit/test_v3_catalog.py1
-rw-r--r--keystone/tests/unit/test_v3_endpoint_policy.py5
-rw-r--r--keystone/tests/unit/test_v3_federation.py23
-rw-r--r--keystone/tests/unit/test_v3_filters.py7
-rw-r--r--keystone/tests/unit/test_v3_identity.py1
-rw-r--r--keystone/tests/unit/test_v3_oauth1.py1
-rw-r--r--keystone/tests/unit/utils.py1
26 files changed, 0 insertions, 126 deletions
diff --git a/keystone/tests/hacking/checks.py b/keystone/tests/hacking/checks.py
index 6f406df87..b8909d084 100644
--- a/keystone/tests/hacking/checks.py
+++ b/keystone/tests/hacking/checks.py
@@ -283,7 +283,6 @@ class CheckForLoggingIssues(BaseASTChecker):
def visit_Call(self, node):
"""Look for the 'LOG.*' calls."""
-
# obj.method
if isinstance(node.func, ast.Attribute):
obj_name = self._find_name(node.func.value)
diff --git a/keystone/tests/unit/backend/domain_config/core.py b/keystone/tests/unit/backend/domain_config/core.py
index 7bbbf313e..5f287ba6a 100644
--- a/keystone/tests/unit/backend/domain_config/core.py
+++ b/keystone/tests/unit/backend/domain_config/core.py
@@ -71,7 +71,6 @@ class DomainConfigTests(object):
def _list_domain_config(self, sensitive):
"""Test listing by combination of domain, group & option."""
-
config1 = {'group': uuid.uuid4().hex, 'option': uuid.uuid4().hex,
'value': uuid.uuid4().hex}
# Put config2 in the same group as config1
@@ -113,7 +112,6 @@ class DomainConfigTests(object):
def _delete_domain_configs(self, sensitive):
"""Test deleting by combination of domain, group & option."""
-
config1 = {'group': uuid.uuid4().hex, 'option': uuid.uuid4().hex,
'value': uuid.uuid4().hex}
# Put config2 and config3 in the same group as config1
@@ -162,7 +160,6 @@ class DomainConfigTests(object):
def _create_domain_config_twice(self, sensitive):
"""Test conflict error thrown if create the same option twice."""
-
config = {'group': uuid.uuid4().hex, 'option': uuid.uuid4().hex,
'value': uuid.uuid4().hex}
@@ -182,7 +179,6 @@ class DomainConfigTests(object):
def test_delete_domain_deletes_configs(self):
"""Test domain deletion clears the domain configs."""
-
domain = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex}
self.resource_api.create_domain(domain['id'], domain)
config1 = {'group': uuid.uuid4().hex, 'option': uuid.uuid4().hex,
@@ -479,7 +475,6 @@ class DomainConfigTests(object):
def test_invalid_sensitive_substitution_in_domain_config(self):
"""Check that invalid substitutions raise warnings."""
-
mock_log = mock.Mock()
invalid_option_config = {
@@ -504,7 +499,6 @@ class DomainConfigTests(object):
def test_escaped_sequence_in_domain_config(self):
"""Check that escaped '%(' doesn't get interpreted."""
-
mock_log = mock.Mock()
escaped_option_config = {
diff --git a/keystone/tests/unit/common/test_notifications.py b/keystone/tests/unit/common/test_notifications.py
index 02609c120..1c624cb3f 100644
--- a/keystone/tests/unit/common/test_notifications.py
+++ b/keystone/tests/unit/common/test_notifications.py
@@ -1004,7 +1004,6 @@ class CadfNotificationsWrapperTestCase(test_v3.RestfulTestCase):
'id': 'openstack:782689dd-f428-4f13-99c7-5c70f94a5ac1'
}
"""
-
note = self._notifications[-1]
event = note['event']
if project:
diff --git a/keystone/tests/unit/contrib/federation/test_utils.py b/keystone/tests/unit/contrib/federation/test_utils.py
index 5804f1c02..2c3a6e8d4 100644
--- a/keystone/tests/unit/contrib/federation/test_utils.py
+++ b/keystone/tests/unit/contrib/federation/test_utils.py
@@ -50,7 +50,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
a direct mapping for the users name.
"""
-
mapping = mapping_fixtures.MAPPING_LARGE
assertion = mapping_fixtures.ADMIN_ASSERTION
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -74,7 +73,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
RuleProcessor should return list of empty group_ids.
"""
-
mapping = mapping_fixtures.MAPPING_LARGE
assertion = mapping_fixtures.BAD_TESTER_ASSERTION
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -93,7 +91,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
a match.
"""
-
mapping = mapping_fixtures.MAPPING_TESTER_REGEX
assertion = mapping_fixtures.TESTER_ASSERTION
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -116,7 +113,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
mapping.
"""
-
mapping = mapping_fixtures.MAPPING_SMALL
assertion = mapping_fixtures.CONTRACTOR_ASSERTION
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -138,7 +134,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
has `not_any_of`, and direct mapping to a username, no group.
"""
-
mapping = mapping_fixtures.MAPPING_LARGE
assertion = mapping_fixtures.CUSTOMER_ASSERTION
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -160,7 +155,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
rules must be matched, including a `not_any_of`.
"""
-
mapping = mapping_fixtures.MAPPING_SMALL
assertion = mapping_fixtures.EMPLOYEE_ASSERTION
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -183,7 +177,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
regex set to True.
"""
-
mapping = mapping_fixtures.MAPPING_DEVELOPER_REGEX
assertion = mapping_fixtures.DEVELOPER_ASSERTION
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -206,7 +199,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
RuleProcessor should return list of empty group_ids.
"""
-
mapping = mapping_fixtures.MAPPING_DEVELOPER_REGEX
assertion = mapping_fixtures.BAD_DEVELOPER_ASSERTION
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -223,7 +215,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
Expect DEVELOPER_GROUP_ID and TESTER_GROUP_ID in the results.
"""
-
mapping = mapping_fixtures.MAPPING_LARGE
rp = mapping_utils.RuleProcessor(mapping['rules'])
values = rp.process(assertion)
@@ -317,7 +308,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
correctly filters out Manager and only allows Developer and Contractor.
"""
-
mapping = mapping_fixtures.MAPPING_GROUPS_WHITELIST
assertion = mapping_fixtures.EMPLOYEE_ASSERTION_MULTIPLE_GROUPS
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -354,7 +344,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
correctly filters out Manager and Developer and only allows Contractor.
"""
-
mapping = mapping_fixtures.MAPPING_GROUPS_BLACKLIST
assertion = mapping_fixtures.EMPLOYEE_ASSERTION_MULTIPLE_GROUPS
rp = mapping_utils.RuleProcessor(mapping['rules'])
@@ -383,7 +372,6 @@ class MappingRuleEngineTests(unit.BaseTestCase):
entry in the remote rules.
"""
-
mapping = mapping_fixtures.MAPPING_GROUPS_BLACKLIST_MULTIPLES
assertion = mapping_fixtures.EMPLOYEE_ASSERTION_MULTIPLE_GROUPS
rp = mapping_utils.RuleProcessor(mapping['rules'])
diff --git a/keystone/tests/unit/core.py b/keystone/tests/unit/core.py
index 794244d0f..20e0a1c5a 100644
--- a/keystone/tests/unit/core.py
+++ b/keystone/tests/unit/core.py
@@ -515,7 +515,6 @@ class TestCase(BaseTestCase):
def load_backends(self):
"""Initializes each manager and assigns them to an attribute."""
-
# TODO(blk-u): Shouldn't need to clear the registry here, but some
# tests call load_backends multiple times. These should be fixed to
# only call load_backends once.
diff --git a/keystone/tests/unit/fakeldap.py b/keystone/tests/unit/fakeldap.py
index 42dab881c..d6bda86fd 100644
--- a/keystone/tests/unit/fakeldap.py
+++ b/keystone/tests/unit/fakeldap.py
@@ -132,7 +132,6 @@ def _paren_groups(source):
def _match(key, value, attrs):
"""Match a given key and value against an attribute list."""
-
def match_with_wildcards(norm_val, val_list):
# Case insensitive checking with wildcards
if norm_val.startswith('*'):
diff --git a/keystone/tests/unit/filtering.py b/keystone/tests/unit/filtering.py
index 93e0bc280..59301299c 100644
--- a/keystone/tests/unit/filtering.py
+++ b/keystone/tests/unit/filtering.py
@@ -49,7 +49,6 @@ class FilterTests(object):
one.
"""
-
f = getattr(self.identity_api, 'create_%s' % entity_type, None)
if f is None:
f = getattr(self.resource_api, 'create_%s' % entity_type, None)
@@ -65,7 +64,6 @@ class FilterTests(object):
one.
"""
-
f = getattr(self.identity_api, 'delete_%s' % entity_type, None)
if f is None:
f = getattr(self.resource_api, 'delete_%s' % entity_type, None)
@@ -81,7 +79,6 @@ class FilterTests(object):
one.
"""
-
f = getattr(self.identity_api, 'list_%ss' % entity_type, None)
if f is None:
f = getattr(self.resource_api, 'list_%ss' % entity_type, None)
diff --git a/keystone/tests/unit/identity_mapping.py b/keystone/tests/unit/identity_mapping.py
index 7fb8063fc..c8f6fd469 100644
--- a/keystone/tests/unit/identity_mapping.py
+++ b/keystone/tests/unit/identity_mapping.py
@@ -17,7 +17,6 @@ from keystone.identity.mapping_backends import sql as mapping_sql
def list_id_mappings():
"""List all id_mappings for testing purposes."""
-
a_session = sql.get_session()
refs = a_session.query(mapping_sql.IDMapping).all()
return [x.to_dict() for x in refs]
diff --git a/keystone/tests/unit/test_backend.py b/keystone/tests/unit/test_backend.py
index 5d5c9031f..5a09a2f72 100644
--- a/keystone/tests/unit/test_backend.py
+++ b/keystone/tests/unit/test_backend.py
@@ -197,7 +197,6 @@ class AssignmentTestHelperMixin(object):
def _create_entity_in_domain(entity_type, domain_id):
"""Create a user or group entity in the domain."""
-
new_entity = {'name': uuid.uuid4().hex, 'domain_id': domain_id}
if entity_type == 'users':
new_entity = self.identity_api.create_user(new_entity)
@@ -288,7 +287,6 @@ class AssignmentTestHelperMixin(object):
def create_group_memberships(self, group_pattern, test_data):
"""Create the group memberships specified in the test plan."""
-
for group_spec in group_pattern:
# Each membership specification is a dict of the form:
#
@@ -304,7 +302,6 @@ class AssignmentTestHelperMixin(object):
def create_assignments(self, assignment_pattern, test_data):
"""Create the assignments specified in the test plan."""
-
# First store how many assignments are already in the system,
# so during the tests we can check the number of new assignments
# created.
@@ -337,7 +334,6 @@ class AssignmentTestHelperMixin(object):
def execute_assignment_tests(self, test_plan, test_data):
"""Execute the test plan, based on the created test_data."""
-
def check_results(expected, actual, param_arg_count):
if param_arg_count == 0:
# It was an unfiltered call, so default fixture assignments
@@ -885,7 +881,6 @@ class IdentityTests(AssignmentTestHelperMixin):
def test_list_role_assignments_unfiltered(self):
"""Test unfiltered listing of role assignments."""
-
test_plan = {
# Create a domain, with a user, group & project
'entities': {'domains': {'users': 1, 'groups': 1, 'projects': 1},
@@ -908,7 +903,6 @@ class IdentityTests(AssignmentTestHelperMixin):
def test_list_role_assignments_filtered_by_role(self):
"""Test listing of role assignments filtered by role ID."""
-
test_plan = {
# Create a user, group & project in the default domain
'entities': {'domains': {'id': DEFAULT_DOMAIN_ID,
@@ -1647,7 +1641,6 @@ class IdentityTests(AssignmentTestHelperMixin):
def test_grant_crud_throws_exception_if_invalid_role(self):
"""Ensure RoleNotFound thrown if role does not exist."""
-
def assert_role_not_found_exception(f, **kwargs):
self.assertRaises(exception.RoleNotFound, f,
role_id=uuid.uuid4().hex, **kwargs)
@@ -1990,7 +1983,6 @@ class IdentityTests(AssignmentTestHelperMixin):
def test_list_role_assignment_by_domain(self):
"""Test listing of role assignment filtered by domain."""
-
test_plan = {
# A domain with 3 users, 1 group, a spoiler domain and 2 roles.
'entities': {'domains': [{'users': 3, 'groups': 1}, 1],
@@ -2020,7 +2012,6 @@ class IdentityTests(AssignmentTestHelperMixin):
def test_list_role_assignment_by_user_with_domain_group_roles(self):
"""Test listing assignments by user, with group roles on a domain."""
-
test_plan = {
# A domain with 3 users, 3 groups, a spoiler domain
# plus 3 roles.
@@ -5706,7 +5697,6 @@ class CatalogTests(object):
def test_get_catalog_endpoint_disabled(self):
"""Get back only enabled endpoints when get the v2 catalog."""
-
service_ref, enabled_endpoint_ref, dummy_disabled_endpoint_ref = (
self._create_endpoints())
@@ -5725,7 +5715,6 @@ class CatalogTests(object):
def test_get_v3_catalog_endpoint_disabled(self):
"""Get back only enabled endpoints when get the v3 catalog."""
-
enabled_endpoint_ref = self._create_endpoints()[1]
user_id = uuid.uuid4().hex
@@ -5927,7 +5916,6 @@ class InheritanceTests(AssignmentTestHelperMixin):
('project_id' or 'domain_id'), respectively.
"""
-
# Create a new role to avoid assignments loaded from default fixtures
role = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex}
role = self.role_api.create_role(role['id'], role)
@@ -6700,7 +6688,6 @@ class FilterTests(filtering.FilterTests):
name, both restrictions have been enforced on what is returned.
"""
-
number_of_groups = 10
group_name_data = {
# entity index: name for entity
@@ -6800,7 +6787,6 @@ class LimitTests(filtering.FilterTests):
def setUp(self):
"""Setup for Limit Test Cases."""
-
self.domain1 = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex}
self.resource_api.create_domain(self.domain1['id'], self.domain1)
self.addCleanup(self.clean_up_domain)
@@ -6817,7 +6803,6 @@ class LimitTests(filtering.FilterTests):
def clean_up_domain(self):
"""Clean up domain test data from Limit Test Cases."""
-
self.domain1['enabled'] = False
self.resource_api.update_domain(self.domain1['id'], self.domain1)
self.resource_api.delete_domain(self.domain1['id'])
diff --git a/keystone/tests/unit/test_backend_endpoint_policy.py b/keystone/tests/unit/test_backend_endpoint_policy.py
index 6c2181aa6..b7dcbdd4e 100644
--- a/keystone/tests/unit/test_backend_endpoint_policy.py
+++ b/keystone/tests/unit/test_backend_endpoint_policy.py
@@ -51,7 +51,6 @@ class PolicyAssociationTests(object):
5 - region 2, Service 0
"""
-
def new_endpoint(region_id, service_id):
endpoint = {'id': uuid.uuid4().hex, 'interface': 'test',
'region_id': region_id, 'service_id': service_id,
diff --git a/keystone/tests/unit/test_backend_ldap.py b/keystone/tests/unit/test_backend_ldap.py
index 98af645aa..79cd54777 100644
--- a/keystone/tests/unit/test_backend_ldap.py
+++ b/keystone/tests/unit/test_backend_ldap.py
@@ -582,7 +582,6 @@ class BaseLDAPIdentity(test_backend.IdentityTests):
are returned.
"""
-
# Create a group
group = dict(name=uuid.uuid4().hex,
domain_id=CONF.identity.default_domain_id)
@@ -818,7 +817,6 @@ class BaseLDAPIdentity(test_backend.IdentityTests):
def test_user_id_comma(self):
"""Even if the user has a , in their ID, groups can be listed."""
-
# Create a user with a , in their ID
# NOTE(blk-u): the DN for this user is hard-coded in fakeldap!
@@ -871,7 +869,6 @@ class BaseLDAPIdentity(test_backend.IdentityTests):
def test_user_id_comma_grants(self):
"""List user and group grants, even with a comma in the user's ID."""
-
# Create a user with a , in their ID
# NOTE(blk-u): the DN for this user is hard-coded in fakeldap!
@@ -2483,7 +2480,6 @@ class BaseMultiLDAPandSQLIdentity(object):
def create_users_across_domains(self):
"""Create a set of users, each with a role on their own domain."""
-
# We also will check that the right number of id mappings get created
initial_mappings = len(mapping_sql.list_id_mappings())
@@ -2952,7 +2948,6 @@ class MultiLDAPandSQLIdentityDomainConfigsInSQL(MultiLDAPandSQLIdentity):
def test_reloading_domain_config(self):
"""Ensure domain drivers are reloaded on a config modification."""
-
domain_cfgs = self.identity_api.domain_configs
# Create a new config for the default domain, hence overwriting the
@@ -2984,7 +2979,6 @@ class MultiLDAPandSQLIdentityDomainConfigsInSQL(MultiLDAPandSQLIdentity):
def test_setting_multiple_sql_driver_raises_exception(self):
"""Ensure setting multiple domain specific sql drivers is prevented."""
-
new_config = {'identity': {'driver': 'sql'}}
self.domain_config_api.create_config(
CONF.identity.default_domain_id, new_config)
@@ -2998,7 +2992,6 @@ class MultiLDAPandSQLIdentityDomainConfigsInSQL(MultiLDAPandSQLIdentity):
def test_same_domain_gets_sql_driver(self):
"""Ensure we can set an SQL driver if we have had it before."""
-
new_config = {'identity': {'driver': 'sql'}}
self.domain_config_api.create_config(
CONF.identity.default_domain_id, new_config)
@@ -3016,7 +3009,6 @@ class MultiLDAPandSQLIdentityDomainConfigsInSQL(MultiLDAPandSQLIdentity):
def test_delete_domain_clears_sql_registration(self):
"""Ensure registration is deleted when a domain is deleted."""
-
domain = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex}
domain = self.resource_api.create_domain(domain['id'], domain)
new_config = {'identity': {'driver': 'sql'}}
@@ -3044,7 +3036,6 @@ class MultiLDAPandSQLIdentityDomainConfigsInSQL(MultiLDAPandSQLIdentity):
def test_orphaned_registration_does_not_prevent_getting_sql_driver(self):
"""Ensure we self heal an orphaned sql registration."""
-
domain = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex}
domain = self.resource_api.create_domain(domain['id'], domain)
new_config = {'identity': {'driver': 'sql'}}
diff --git a/keystone/tests/unit/test_backend_sql.py b/keystone/tests/unit/test_backend_sql.py
index 1b2858fcb..64211e720 100644
--- a/keystone/tests/unit/test_backend_sql.py
+++ b/keystone/tests/unit/test_backend_sql.py
@@ -748,7 +748,6 @@ class SqlFilterTests(SqlTests, test_backend.FilterTests):
def clean_up_entities(self):
"""Clean up entity test data from Filter Test Cases."""
-
for entity in ['user', 'group', 'project']:
self._delete_test_data(entity, self.entity_list[entity])
self._delete_test_data(entity, self.domain1_entity_list[entity])
diff --git a/keystone/tests/unit/test_revoke.py b/keystone/tests/unit/test_revoke.py
index 9062981f2..be2251e7a 100644
--- a/keystone/tests/unit/test_revoke.py
+++ b/keystone/tests/unit/test_revoke.py
@@ -67,7 +67,6 @@ def _matches(event, token_values):
:returns if the token matches the revocation event, indicating the
token has been revoked
"""
-
# The token has three attributes that can match the user_id
if event.user_id is not None:
for attribute_name in ['user_id', 'trustor_id', 'trustee_id']:
diff --git a/keystone/tests/unit/test_sql_upgrade.py b/keystone/tests/unit/test_sql_upgrade.py
index aac30e83d..f0f43a806 100644
--- a/keystone/tests/unit/test_sql_upgrade.py
+++ b/keystone/tests/unit/test_sql_upgrade.py
@@ -502,7 +502,6 @@ class SqlUpgradeTests(SqlMigrateBase):
def does_pk_exist(self, table, pk_column):
"""Checks whether a column is primary key on a table."""
-
inspector = reflection.Inspector.from_engine(self.engine)
pk_columns = inspector.get_pk_constraint(table)['constrained_columns']
@@ -856,7 +855,6 @@ class VersionTests(SqlMigrateBase):
def test_unexpected_extension(self):
"""The version for a non-existent extension raises ImportError."""
-
extension_name = uuid.uuid4().hex
self.assertRaises(ImportError,
migration_helpers.get_db_version,
@@ -864,7 +862,6 @@ class VersionTests(SqlMigrateBase):
def test_unversioned_extension(self):
"""The version for extensions without migrations raise an exception."""
-
self.assertRaises(exception.MigrationNotProvided,
migration_helpers.get_db_version,
extension='admin_crud')
diff --git a/keystone/tests/unit/test_v2.py b/keystone/tests/unit/test_v2.py
index 5216a4801..465c6b7a0 100644
--- a/keystone/tests/unit/test_v2.py
+++ b/keystone/tests/unit/test_v2.py
@@ -1245,7 +1245,6 @@ class V2TestCase(RestfulTestCase, CoreApiTests, LegacyV2UsernameTests):
"""If the server is configured for md5, then the revocation list has
tokens hashed with MD5.
"""
-
# The default hash algorithm is md5.
hash_algorithm = 'md5'
@@ -1257,7 +1256,6 @@ class V2TestCase(RestfulTestCase, CoreApiTests, LegacyV2UsernameTests):
"""If the server is configured for sha256, then the revocation list has
tokens hashed with SHA256
"""
-
hash_algorithm = 'sha256'
self.config_fixture.config(group='token',
hash_algorithm=hash_algorithm)
diff --git a/keystone/tests/unit/test_v2_controller.py b/keystone/tests/unit/test_v2_controller.py
index cc06a6cb9..5f1f0a948 100644
--- a/keystone/tests/unit/test_v2_controller.py
+++ b/keystone/tests/unit/test_v2_controller.py
@@ -74,7 +74,6 @@ class TenantTestCase(unit.TestCase):
def test_list_projects_default_domain(self):
"""Test that list projects only returns those in the default domain."""
-
domain = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex,
'enabled': True}
self.resource_api.create_domain(domain['id'], domain)
diff --git a/keystone/tests/unit/test_v3.py b/keystone/tests/unit/test_v3.py
index 6007ccedf..a6323c1b8 100644
--- a/keystone/tests/unit/test_v3.py
+++ b/keystone/tests/unit/test_v3.py
@@ -406,7 +406,6 @@ class RestfulTestCase(unit.SQLDriverOverrides, rest.RestfulTestCase,
def get_requested_token(self, auth):
"""Request the specific token we want."""
-
r = self.v3_create_token(auth)
return r.headers.get('X-Subject-Token')
@@ -1307,7 +1306,6 @@ class AssignmentTestMixin(object):
Available filters are: domain_id, project_id, user_id, group_id,
role_id and inherited_to_projects.
"""
-
query_params = '?effective' if effective else ''
for k, v in filters.items():
@@ -1332,7 +1330,6 @@ class AssignmentTestMixin(object):
Provided attributes are expected to contain: domain_id or project_id,
user_id or group_id, role_id and, optionally, inherited_to_projects.
"""
-
if attribs.get('domain_id'):
link = '/domains/' + attribs['domain_id']
else:
@@ -1356,7 +1353,6 @@ class AssignmentTestMixin(object):
Provided attributes are expected to contain: domain_id or project_id,
user_id or group_id, role_id and, optionally, inherited_to_projects.
"""
-
entity = {'links': {'assignment': (
link or self.build_role_assignment_link(**attribs))}}
diff --git a/keystone/tests/unit/test_v3_assignment.py b/keystone/tests/unit/test_v3_assignment.py
index 663bc01c5..9eb6747f1 100644
--- a/keystone/tests/unit/test_v3_assignment.py
+++ b/keystone/tests/unit/test_v3_assignment.py
@@ -184,7 +184,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
def test_delete_enabled_domain_fails(self):
"""Call ``DELETE /domains/{domain_id}`` (when domain enabled)."""
-
# Try deleting an enabled domain, which should fail
self.delete('/domains/%(domain_id)s' % {
'domain_id': self.domain['id']},
@@ -210,7 +209,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
- Check entities in self.domain are unaffected
"""
-
# Create a 2nd set of entities in a 2nd domain
self.domain2 = self.new_domain_ref()
self.resource_api.create_domain(self.domain2['id'], self.domain2)
@@ -341,7 +339,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
becomes invalid once that domain is disabled.
"""
-
self.domain = self.new_domain_ref()
self.resource_api.create_domain(self.domain['id'], self.domain)
@@ -457,7 +454,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
This includes operations like create, update, delete.
"""
-
non_default_name = 'beta_federated_domain'
self.config_fixture.config(group='federation',
federated_domain_name=non_default_name)
@@ -516,7 +512,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
@utils.wip('waiting for projects acting as domains implementation')
def test_create_project_without_parent_id_and_without_domain_id(self):
"""Call ``POST /projects``."""
-
# Grant a domain role for the user
collection_url = (
'/domains/%(domain_id)s/users/%(user_id)s/roles' % {
@@ -716,7 +711,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
'project' and 'parent'.
"""
-
# Create the project hierarchy
parent, project, subproject = self._create_projects_hierarchy(2)
@@ -747,7 +741,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
'parent'.
"""
-
# Create the project hierarchy
parent, project, subproject = self._create_projects_hierarchy(2)
@@ -883,7 +876,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
and 'subproject'.
"""
-
# Create the project hierarchy
parent, project, subproject = self._create_projects_hierarchy(2)
@@ -913,7 +905,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
- Check that calling subtree_as_list on 'parent' returns 'subproject'.
"""
-
# Create the project hierarchy
parent, project, subproject = self._create_projects_hierarchy(2)
@@ -1153,7 +1144,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
returns Not Found for the user.
"""
-
user_id = uuid.uuid4().hex
collection_url = (
@@ -1192,7 +1182,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
returns 404 Not Found for the user.
"""
-
user_id = uuid.uuid4().hex
collection_url = (
@@ -1231,7 +1220,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
server returns 404 Not Found for the group.
"""
-
group_id = uuid.uuid4().hex
collection_url = (
@@ -1271,7 +1259,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
returns 404 Not Found for the group.
"""
-
group_id = uuid.uuid4().hex
collection_url = (
@@ -1392,7 +1379,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
been removed
"""
-
# Since the default fixtures already assign some roles to the
# user it creates, we also need a new user that will not have any
# existing assignments
@@ -1641,7 +1627,6 @@ class AssignmentTestCase(test_v3.RestfulTestCase,
token (all effective roles for a user on a project)
"""
-
# Since the default fixtures already assign some roles to the
# user it creates, we also need a new user that will not have any
# existing assignments
@@ -1888,7 +1873,6 @@ class RoleAssignmentBaseTestCase(test_v3.RestfulTestCase,
queried URL.
"""
-
query_url = self._get_role_assignments_query_url(**filters)
response = self.get(query_url, expected_status=expected_status)
@@ -1967,7 +1951,6 @@ class RoleAssignmentDirectTestCase(RoleAssignmentBaseTestCase):
group_id, user_id and inherited_to_projects.
"""
-
# Fills default assignment with provided filters
test_assignment = self._set_default_assignment_attributes(**filters)
@@ -2511,7 +2494,6 @@ class AssignmentInheritanceTestCase(test_v3.RestfulTestCase,
shows up.
"""
-
role_list = []
for _ in range(4):
role = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex}
diff --git a/keystone/tests/unit/test_v3_auth.py b/keystone/tests/unit/test_v3_auth.py
index 7bc6b8990..bb1311b32 100644
--- a/keystone/tests/unit/test_v3_auth.py
+++ b/keystone/tests/unit/test_v3_auth.py
@@ -981,7 +981,6 @@ class TestTokenRevokeById(test_v3.RestfulTestCase):
the one for Project C
"""
-
self.role_data_fixtures()
# Now we are ready to start issuing requests
@@ -1281,7 +1280,6 @@ class TestTokenRevokeById(test_v3.RestfulTestCase):
def test_removing_role_assignment_does_not_affect_other_users(self):
"""Revoking a role from one user should not affect other users."""
-
# This group grant is not needed for the test
self.delete(
'/projects/%(project_id)s/groups/%(group_id)s/roles/%(role_id)s' %
@@ -1990,7 +1988,6 @@ class TestAuth(test_v3.RestfulTestCase):
def test_auth_catalog_disabled_endpoint(self):
"""On authenticate, get a catalog that excludes disabled endpoints."""
-
# Create a disabled endpoint that's like the enabled one.
disabled_endpoint_ref = copy.copy(self.endpoint)
disabled_endpoint_id = uuid.uuid4().hex
@@ -2044,7 +2041,6 @@ class TestAuth(test_v3.RestfulTestCase):
tokens
"""
-
domainA = self.new_domain_ref()
self.resource_api.create_domain(domainA['id'], domainA)
projectA = self.new_project_ref(domain_id=domainA['id'])
@@ -4507,7 +4503,6 @@ class TestFernetTokenProvider(test_v3.RestfulTestCase):
Test that validating an domain scoped token in v2.0
returns unauthorized.
"""
-
# Grant user access to domain
self.assignment_api.create_grant(self.role['id'],
user_id=self.user['id'],
@@ -4524,7 +4519,6 @@ class TestFernetTokenProvider(test_v3.RestfulTestCase):
Test that validating an trust scoped token in v2.0 returns
unauthorized.
"""
-
trustee_user, trust = self._create_trust()
trust_scoped_token = self._get_trust_scoped_token(trustee_user, trust)
self.assertRaises(exception.Unauthorized,
diff --git a/keystone/tests/unit/test_v3_catalog.py b/keystone/tests/unit/test_v3_catalog.py
index 6a85adda1..06bf8e31e 100644
--- a/keystone/tests/unit/test_v3_catalog.py
+++ b/keystone/tests/unit/test_v3_catalog.py
@@ -238,7 +238,6 @@ class CatalogTestCase(test_v3.RestfulTestCase):
def test_delete_region(self):
"""Call ``DELETE /regions/{region_id}``."""
-
ref = self.new_region_ref()
r = self.post(
'/regions',
diff --git a/keystone/tests/unit/test_v3_endpoint_policy.py b/keystone/tests/unit/test_v3_endpoint_policy.py
index b0c8256e8..ef91a2f81 100644
--- a/keystone/tests/unit/test_v3_endpoint_policy.py
+++ b/keystone/tests/unit/test_v3_endpoint_policy.py
@@ -69,7 +69,6 @@ class EndpointPolicyTestCase(test_v3.RestfulTestCase):
def test_crud_for_policy_for_explicit_endpoint(self):
"""PUT, HEAD and DELETE for explicit endpoint policy."""
-
url = ('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
'/endpoints/%(endpoint_id)s') % {
'policy_id': self.policy['id'],
@@ -78,7 +77,6 @@ class EndpointPolicyTestCase(test_v3.RestfulTestCase):
def test_crud_for_policy_for_service(self):
"""PUT, HEAD and DELETE for service endpoint policy."""
-
url = ('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
'/services/%(service_id)s') % {
'policy_id': self.policy['id'],
@@ -87,7 +85,6 @@ class EndpointPolicyTestCase(test_v3.RestfulTestCase):
def test_crud_for_policy_for_region_and_service(self):
"""PUT, HEAD and DELETE for region and service endpoint policy."""
-
url = ('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
'/services/%(service_id)s/regions/%(region_id)s') % {
'policy_id': self.policy['id'],
@@ -97,7 +94,6 @@ class EndpointPolicyTestCase(test_v3.RestfulTestCase):
def test_get_policy_for_endpoint(self):
"""GET /endpoints/{endpoint_id}/policy."""
-
self.put('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
'/endpoints/%(endpoint_id)s' % {
'policy_id': self.policy['id'],
@@ -115,7 +111,6 @@ class EndpointPolicyTestCase(test_v3.RestfulTestCase):
def test_list_endpoints_for_policy(self):
"""GET /policies/%(policy_id}/endpoints."""
-
self.put('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
'/endpoints/%(endpoint_id)s' % {
'policy_id': self.policy['id'],
diff --git a/keystone/tests/unit/test_v3_federation.py b/keystone/tests/unit/test_v3_federation.py
index e28a2ffeb..a873f856e 100644
--- a/keystone/tests/unit/test_v3_federation.py
+++ b/keystone/tests/unit/test_v3_federation.py
@@ -137,7 +137,6 @@ class FederatedSetupMixin(object):
def assertValidMappedUser(self, token):
"""Check if user object meets all the criteria."""
-
user = token['user']
self.assertIn('id', user)
self.assertIn('name', user)
@@ -209,7 +208,6 @@ class FederatedSetupMixin(object):
def load_federation_sample_data(self):
"""Inject additional data."""
-
# Create and add domains
self.domainA = self.new_domain_ref()
self.resource_api.create_domain(self.domainA['id'],
@@ -856,7 +854,6 @@ class FederatedIdentityProviderTests(FederationTests):
def test_create_idp(self):
"""Creates the IdentityProvider entity associated to remote_ids."""
-
keys_to_check = list(self.idp_keys)
body = self.default_body.copy()
body['description'] = uuid.uuid4().hex
@@ -867,7 +864,6 @@ class FederatedIdentityProviderTests(FederationTests):
def test_create_idp_remote(self):
"""Creates the IdentityProvider entity associated to remote_ids."""
-
keys_to_check = list(self.idp_keys)
keys_to_check.append('remote_ids')
body = self.default_body.copy()
@@ -889,7 +885,6 @@ class FederatedIdentityProviderTests(FederationTests):
Expect HTTP 409 Conflict code for the latter call.
"""
-
body = self.default_body.copy()
repeated_remote_id = uuid.uuid4().hex
body['remote_ids'] = [uuid.uuid4().hex,
@@ -906,7 +901,6 @@ class FederatedIdentityProviderTests(FederationTests):
def test_create_idp_remote_empty(self):
"""Creates an IdP with empty remote_ids."""
-
keys_to_check = list(self.idp_keys)
keys_to_check.append('remote_ids')
body = self.default_body.copy()
@@ -919,7 +913,6 @@ class FederatedIdentityProviderTests(FederationTests):
def test_create_idp_remote_none(self):
"""Creates an IdP with a None remote_ids."""
-
keys_to_check = list(self.idp_keys)
keys_to_check.append('remote_ids')
body = self.default_body.copy()
@@ -1072,7 +1065,6 @@ class FederatedIdentityProviderTests(FederationTests):
def test_delete_idp_also_deletes_assigned_protocols(self):
"""Deleting an IdP will delete its assigned protocol."""
-
# create default IdP
default_resp = self._create_default_idp()
default_idp = self._fetch_attribute_from_response(default_resp,
@@ -1178,7 +1170,6 @@ class FederatedIdentityProviderTests(FederationTests):
def test_assign_protocol_to_idp(self):
"""Assign a protocol to existing IdP."""
-
self._assign_protocol_to_idp(expected_status=http_client.CREATED)
def test_protocol_composite_pk(self):
@@ -1224,7 +1215,6 @@ class FederatedIdentityProviderTests(FederationTests):
Expect HTTP 404 Not Found code.
"""
-
idp_id = uuid.uuid4().hex
kwargs = {'expected_status': http_client.NOT_FOUND}
self._assign_protocol_to_idp(proto='saml2',
@@ -1234,7 +1224,6 @@ class FederatedIdentityProviderTests(FederationTests):
def test_get_protocol(self):
"""Create and later fetch protocol tied to IdP."""
-
resp, idp_id, proto = self._assign_protocol_to_idp(
expected_status=http_client.CREATED)
proto_id = self._fetch_attribute_from_response(resp, 'protocol')['id']
@@ -1280,7 +1269,6 @@ class FederatedIdentityProviderTests(FederationTests):
def test_update_protocols_attribute(self):
"""Update protocol's attribute."""
-
resp, idp_id, proto = self._assign_protocol_to_idp(
expected_status=http_client.CREATED)
new_mapping_id = uuid.uuid4().hex
@@ -1697,7 +1685,6 @@ class FederatedTokenTests(FederationTests, FederatedSetupMixin):
def test_scope_to_bad_project(self):
"""Scope unscoped token with a project we don't have access to."""
-
self.v3_create_token(
self.TOKEN_SCOPE_PROJECT_EMPLOYEE_FROM_CUSTOMER,
expected_status=http_client.UNAUTHORIZED)
@@ -1711,7 +1698,6 @@ class FederatedTokenTests(FederationTests, FederatedSetupMixin):
* Employees' project
"""
-
bodies = (self.TOKEN_SCOPE_PROJECT_EMPLOYEE_FROM_ADMIN,
self.TOKEN_SCOPE_PROJECT_CUSTOMER_FROM_ADMIN)
project_ids = (self.proj_employees['id'],
@@ -1892,7 +1878,6 @@ class FederatedTokenTests(FederationTests, FederatedSetupMixin):
* Scope token to one of available projects
"""
-
r = self._issue_unscoped_token()
token_resp = r.json_body['token']
self.assertValidMappedUser(token_resp)
@@ -2054,7 +2039,6 @@ class FederatedTokenTests(FederationTests, FederatedSetupMixin):
assigned
"""
-
domain_id = self.domainA['id']
domain_name = self.domainA['name']
@@ -2129,7 +2113,6 @@ class FederatedTokenTests(FederationTests, FederatedSetupMixin):
assigned
"""
-
domain_id = self.domainA['id']
domain_name = self.domainA['name']
@@ -2799,7 +2782,6 @@ class SAMLGenerationTests(FederationTests):
Raises exception.SchemaValidationError() - error 400 Bad Request
"""
-
token_id = uuid.uuid4().hex
body = self._create_generate_saml_request(token_id,
self.SERVICE_PROVDIER_ID)
@@ -2814,7 +2796,6 @@ class SAMLGenerationTests(FederationTests):
Raises exception.SchemaValidationError() - error 400 Bad Request
"""
-
token_id = uuid.uuid4().hex
body = self._create_generate_saml_request(token_id,
self.SERVICE_PROVDIER_ID)
@@ -2837,7 +2818,6 @@ class SAMLGenerationTests(FederationTests):
def test_sp_disabled(self):
"""Try generating assertion for disabled Service Provider."""
-
# Disable Service Provider
sp_ref = {'enabled': False}
self.federation_api.update_sp(self.SERVICE_PROVDIER_ID, sp_ref)
@@ -2854,7 +2834,6 @@ class SAMLGenerationTests(FederationTests):
Raises exception.TokenNotFound() - error Not Found 404
"""
-
token_id = uuid.uuid4().hex
body = self._create_generate_saml_request(token_id,
self.SERVICE_PROVDIER_ID)
@@ -2870,7 +2849,6 @@ class SAMLGenerationTests(FederationTests):
The controller should return a SAML assertion that is wrapped in a
SOAP envelope.
"""
-
self.config_fixture.config(group='saml', idp_entity_id=self.ISSUER)
token_id = self._fetch_valid_token()
body = self._create_generate_saml_request(token_id,
@@ -3439,7 +3417,6 @@ class K2KServiceCatalogTests(FederationTests):
def test_service_providers_in_token(self):
"""Check if service providers are listed in service catalog."""
-
token = self.token_v3_helper.get_token_data(self.user_id, ['password'])
ref = {}
for r in (self.sp_alpha, self.sp_beta, self.sp_gamma):
diff --git a/keystone/tests/unit/test_v3_filters.py b/keystone/tests/unit/test_v3_filters.py
index 668a23089..1bb498724 100644
--- a/keystone/tests/unit/test_v3_filters.py
+++ b/keystone/tests/unit/test_v3_filters.py
@@ -33,7 +33,6 @@ class IdentityTestFilteredCase(filtering.FilterTests,
def setUp(self):
"""Setup for Identity Filter Test Cases."""
-
super(IdentityTestFilteredCase, self).setUp()
self.tempfile = self.useFixture(temporaryfile.SecureTempFile())
self.tmpfilename = self.tempfile.file_name
@@ -329,7 +328,6 @@ class IdentityTestListLimitCase(IdentityTestFilteredCase):
def setUp(self):
"""Setup for Identity Limit Test Cases."""
-
super(IdentityTestListLimitCase, self).setUp()
# Create 10 entries for each of the entities we are going to test
@@ -359,18 +357,15 @@ class IdentityTestListLimitCase(IdentityTestFilteredCase):
def clean_up_entity(self, entity):
"""Clean up entity test data from Identity Limit Test Cases."""
-
self._delete_test_data(entity, self.entity_lists[entity])
def clean_up_service(self):
"""Clean up service test data from Identity Limit Test Cases."""
-
for service in self.service_list:
self.catalog_api.delete_service(service['id'])
def clean_up_policy(self):
"""Clean up policy test data from Identity Limit Test Cases."""
-
for policy in self.policy_list:
self.policy_api.delete_policy(policy['id'])
@@ -430,7 +425,6 @@ class IdentityTestListLimitCase(IdentityTestFilteredCase):
def test_no_limit(self):
"""Check truncated attribute not set when list not limited."""
-
self._set_policy({"identity:list_services": []})
r = self.get('/services', auth=self.auth)
self.assertEqual(10, len(r.result.get('services')))
@@ -438,7 +432,6 @@ class IdentityTestListLimitCase(IdentityTestFilteredCase):
def test_at_limit(self):
"""Check truncated attribute not set when list at max size."""
-
# Test this by overriding the general limit with a higher
# driver-specific limit (allowing all entities to be returned
# in the collection), which should result in a non truncated list
diff --git a/keystone/tests/unit/test_v3_identity.py b/keystone/tests/unit/test_v3_identity.py
index c411b8b39..d376981b2 100644
--- a/keystone/tests/unit/test_v3_identity.py
+++ b/keystone/tests/unit/test_v3_identity.py
@@ -209,7 +209,6 @@ class IdentityTestCase(test_v3.RestfulTestCase):
def test_list_groups_for_user(self):
"""Call ``GET /users/{user_id}/groups``."""
-
self.user1 = self.new_user_ref(
domain_id=self.domain['id'])
password = self.user1['password']
diff --git a/keystone/tests/unit/test_v3_oauth1.py b/keystone/tests/unit/test_v3_oauth1.py
index cb28bf69d..c7d317a1c 100644
--- a/keystone/tests/unit/test_v3_oauth1.py
+++ b/keystone/tests/unit/test_v3_oauth1.py
@@ -801,7 +801,6 @@ class OAuthNotificationTests(OAuth1Tests,
notifications for request token creation, and access token
creation/deletion are emitted.
"""
-
consumer = self._create_single_consumer()
consumer_id = consumer['id']
consumer_secret = consumer['secret']
diff --git a/keystone/tests/unit/utils.py b/keystone/tests/unit/utils.py
index 17d1de815..93a57af99 100644
--- a/keystone/tests/unit/utils.py
+++ b/keystone/tests/unit/utils.py
@@ -72,7 +72,6 @@ def wip(message):
>>> pass
"""
-
def _wip(f):
@six.wraps(f)
def run_test(*args, **kwargs):