diff options
author | Ionuț Arțăriși <iartarisi@suse.cz> | 2013-02-11 17:15:23 +0100 |
---|---|---|
committer | Ionuț Arțăriși <iartarisi@suse.cz> | 2013-02-18 17:02:44 +0100 |
commit | 159ffe48e986e524f5930ad41d376bdce2b6a07e (patch) | |
tree | eddb5a177f2b29265b687087a2411608a832737e /tests/test_backend_ldap.py | |
parent | 63f6e87c5e267a015f4d6054c0941c0efc8526f1 (diff) | |
download | keystone-159ffe48e986e524f5930ad41d376bdce2b6a07e.tar.gz keystone-159ffe48e986e524f5930ad41d376bdce2b6a07e.tar.xz keystone-159ffe48e986e524f5930ad41d376bdce2b6a07e.zip |
make LDAP query scope configurable
Get the DN from the LDAP server itself rather than hardcoding its format.
Fixes bug 1122181
Change-Id: I6f70c480b5c6f1b064e74d3cbd2cd8ca5ee82b0a
Diffstat (limited to 'tests/test_backend_ldap.py')
-rw-r--r-- | tests/test_backend_ldap.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_backend_ldap.py b/tests/test_backend_ldap.py index b5ad68b3..8a116cfa 100644 --- a/tests/test_backend_ldap.py +++ b/tests/test_backend_ldap.py @@ -14,9 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. +import ldap import uuid import nose.exc +from keystone.common import ldap as ldap_common from keystone.common.ldap import fakeldap from keystone import config from keystone import exception @@ -42,6 +44,9 @@ class LDAPIdentity(test.TestCase, test_backend.IdentityTests): test.testsdir('test_overrides.conf'), test.testsdir('backend_ldap.conf')]) clear_database() + self.stubs.Set(ldap_common.BaseLdap, "_id_to_dn", + lambda self, id: '%s=%s,%s' % (self.id_attr, + str(id), self.tree_dn)) self.identity_api = identity_ldap.Identity() self.load_fixtures(default_fixtures) @@ -347,6 +352,13 @@ class LDAPIdentity(test.TestCase, test_backend.IdentityTests): user_api.get_connection(user=None, password=None) + def test_wrong_ldap_scope(self): + CONF.ldap.query_scope = uuid.uuid4().hex + self.assertRaisesRegexp( + ValueError, + 'Invalid LDAP scope: %s. *' % CONF.ldap.query_scope, + identity_ldap.Identity) + # TODO (henry-nash) These need to be removed when the full LDAP implementation # is submitted - see Bugs 1092187, 1101287, 1101276, 1101289 def test_group_crud(self): |