2a78594153
implementations of delete_tenant, delete_user, remove_role_from_user_and_tenant, get_tenant_users role.delete_user and remove_role_from_user_and_tenant remove_user_from_tenant, change_ role clean up LDAP sample data for live LDAP properly check for existance of tenant_id in user. Some tests expected the functions to be unimplemented. Those hid the failuers on the LDAP Identity provider and have been removed. Make live tests extend the standard LDAP tests, so they test the same features. Bug 1021315 Change-Id: I2866ff40fdc13040ba10d189ea2d95440eb4395c
72 lines
2.2 KiB
Python
72 lines
2.2 KiB
Python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
# Copyright 2012 OpenStack LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import subprocess
|
|
|
|
from keystone import config
|
|
from keystone.identity.backends import ldap as identity_ldap
|
|
from keystone import test
|
|
|
|
import default_fixtures
|
|
import test_backend
|
|
import test_backend_ldap
|
|
|
|
|
|
CONF = config.CONF
|
|
|
|
|
|
def delete_object(name):
|
|
devnull = open('/dev/null', 'w')
|
|
dn = '%s,%s' % (name, CONF.ldap.suffix)
|
|
subprocess.call(['ldapdelete',
|
|
'-x',
|
|
'-D', CONF.ldap.user,
|
|
'-H', CONF.ldap.url,
|
|
'-w', CONF.ldap.password,
|
|
dn],
|
|
stderr=devnull)
|
|
|
|
|
|
def clear_live_database():
|
|
roles = ['keystone_admin', 'fake1', 'fake2', 'useless']
|
|
groups = ['baz', 'bar', 'tenent4add', 'fake1', 'fake2']
|
|
users = ['foo', 'two', 'fake1', 'fake2', 'no_meta']
|
|
|
|
for group in groups:
|
|
for role in roles:
|
|
delete_object('cn=%s,cn=%s,ou=Groups' % (role, group))
|
|
delete_object('cn=%s,ou=Groups' % group)
|
|
|
|
for user in users:
|
|
delete_object('cn=%s,ou=Users' % user)
|
|
|
|
for role in roles:
|
|
delete_object('cn=%s,ou=Roles' % role)
|
|
|
|
|
|
class LiveLDAPIdentity(test_backend_ldap.LDAPIdentity):
|
|
def setUp(self):
|
|
super(LiveLDAPIdentity, self).setUp()
|
|
self.config([test.etcdir('keystone.conf.sample'),
|
|
test.testsdir('test_overrides.conf'),
|
|
test.testsdir('backend_liveldap.conf')])
|
|
clear_live_database()
|
|
self.identity_api = identity_ldap.Identity()
|
|
self.load_fixtures(default_fixtures)
|
|
|
|
def tearDown(self):
|
|
test.TestCase.tearDown(self)
|