Add ability to run fakeldap in memory.
Tests speedup. Change-Id: I6c1df5990cf2b6c45ea7cab03905c89b92749c9c
This commit is contained in:
parent
95f49529a1
commit
fc6dfe4768
@ -123,12 +123,28 @@ def _subs(value):
|
||||
server_fail = False
|
||||
|
||||
|
||||
class FakeShelve(dict):
|
||||
@classmethod
|
||||
def get_instance(cls):
|
||||
try:
|
||||
return cls.__instance
|
||||
except AttributeError:
|
||||
cls.__instance = cls()
|
||||
return cls.__instance
|
||||
|
||||
def sync(self):
|
||||
pass
|
||||
|
||||
|
||||
class FakeLDAP(object):
|
||||
"""Fake LDAP connection."""
|
||||
|
||||
def __init__(self, url):
|
||||
LOG.debug("FakeLDAP initialize url=%s" % (url,))
|
||||
self.db = shelve.open(url[7:])
|
||||
if url == 'fake://memory':
|
||||
self.db = FakeShelve.get_instance()
|
||||
else:
|
||||
self.db = shelve.open(url[7:])
|
||||
|
||||
def simple_bind_s(self, dn, password):
|
||||
"""This method is ignored, but provided for compatibility."""
|
||||
|
@ -21,7 +21,7 @@ sql_idle_timeout = 30
|
||||
backend_entities = ['Endpoints', 'Credentials', 'EndpointTemplates', 'Token', 'Service']
|
||||
|
||||
[keystone.backends.ldap]
|
||||
ldap_url = fake://%(test_dir)s/ldap.db
|
||||
ldap_url = fake://memory
|
||||
ldap_user = cn=Admin
|
||||
ldap_password = password
|
||||
backend_entities = ['Tenant', 'User', 'UserRoleAssociation', 'Role']
|
||||
|
Loading…
Reference in New Issue
Block a user