From 3432685a1e387f35e28777c9a42133f3bc145179 Mon Sep 17 00:00:00 2001 From: David Stanek Date: Tue, 28 Mar 2017 21:18:01 +0000 Subject: [PATCH] Remove orphaned AuthTestMixin from test_v3 The code was moved to keystone.tests.common.auth and later modified. The class in keystone.tests.unit.test_v3 is no longer being used. Change-Id: Ib89046b4c991d319c03ecd7dddf452dd315e1aad --- keystone/tests/unit/test_v3.py | 84 ---------------------------------- 1 file changed, 84 deletions(-) diff --git a/keystone/tests/unit/test_v3.py b/keystone/tests/unit/test_v3.py index ff0a265e04..605bdba947 100644 --- a/keystone/tests/unit/test_v3.py +++ b/keystone/tests/unit/test_v3.py @@ -25,7 +25,6 @@ from keystone import auth from keystone.common import authorization from keystone.common import cache from keystone.common.validation import validators -import keystone.conf from keystone import exception from keystone import middleware from keystone.tests.common import auth as common_auth @@ -33,94 +32,11 @@ from keystone.tests import unit from keystone.tests.unit import rest -CONF = keystone.conf.CONF DEFAULT_DOMAIN_ID = 'default' TIME_FORMAT = unit.TIME_FORMAT -class AuthTestMixin(object): - """To hold auth building helper functions.""" - - def build_auth_scope(self, project_id=None, project_name=None, - project_domain_id=None, project_domain_name=None, - domain_id=None, domain_name=None, trust_id=None, - unscoped=None, is_domain=None): - scope_data = {} - if unscoped: - scope_data['unscoped'] = {} - if project_id or project_name: - scope_data['project'] = {} - if project_id: - scope_data['project']['id'] = project_id - else: - scope_data['project']['name'] = project_name - if is_domain is not None: - scope_data['is_domain'] = is_domain - if project_domain_id or project_domain_name: - project_domain_json = {} - if project_domain_id: - project_domain_json['id'] = project_domain_id - else: - project_domain_json['name'] = project_domain_name - scope_data['project']['domain'] = project_domain_json - if domain_id or domain_name: - scope_data['domain'] = {} - if domain_id: - scope_data['domain']['id'] = domain_id - else: - scope_data['domain']['name'] = domain_name - if trust_id: - scope_data['OS-TRUST:trust'] = {} - scope_data['OS-TRUST:trust']['id'] = trust_id - return scope_data - - def build_password_auth(self, user_id=None, username=None, - user_domain_id=None, user_domain_name=None, - password=None): - password_data = {'user': {}} - if user_id: - password_data['user']['id'] = user_id - else: - password_data['user']['name'] = username - if user_domain_id or user_domain_name: - password_data['user']['domain'] = {} - if user_domain_id: - password_data['user']['domain']['id'] = user_domain_id - else: - password_data['user']['domain']['name'] = user_domain_name - password_data['user']['password'] = password - return password_data - - def build_token_auth(self, token): - return {'id': token} - - def build_authentication_request(self, token=None, user_id=None, - username=None, user_domain_id=None, - user_domain_name=None, password=None, - kerberos=False, **kwargs): - """Build auth dictionary. - - It will create an auth dictionary based on all the arguments - that it receives. - """ - auth_data = {} - auth_data['identity'] = {'methods': []} - if kerberos: - auth_data['identity']['methods'].append('kerberos') - auth_data['identity']['kerberos'] = {} - if token: - auth_data['identity']['methods'].append('token') - auth_data['identity']['token'] = self.build_token_auth(token) - if user_id or username: - auth_data['identity']['methods'].append('password') - auth_data['identity']['password'] = self.build_password_auth( - user_id, username, user_domain_id, user_domain_name, password) - if kwargs: - auth_data['scope'] = self.build_auth_scope(**kwargs) - return {'auth': auth_data} - - class RestfulTestCase(unit.SQLDriverOverrides, rest.RestfulTestCase, common_auth.AuthTestMixin):