summaryrefslogtreecommitdiffstats
path: root/tests/test_backend_ldap.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-20 10:28:19 +0000
committerGerrit Code Review <review@openstack.org>2013-02-20 10:28:19 +0000
commitd036db145d51f8b134ffa36165065a8986e4f8a1 (patch)
tree23509320bb98dad85d23e008a9ad0093067917ca /tests/test_backend_ldap.py
parent9f62f0862b371d2a190e871fb3fdebf9b09a7698 (diff)
parent159ffe48e986e524f5930ad41d376bdce2b6a07e (diff)
downloadkeystone-d036db145d51f8b134ffa36165065a8986e4f8a1.tar.gz
keystone-d036db145d51f8b134ffa36165065a8986e4f8a1.tar.xz
keystone-d036db145d51f8b134ffa36165065a8986e4f8a1.zip
Merge "make LDAP query scope configurable"
Diffstat (limited to 'tests/test_backend_ldap.py')
-rw-r--r--tests/test_backend_ldap.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_backend_ldap.py b/tests/test_backend_ldap.py
index 4cf8d17e..63499bd1 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):