summaryrefslogtreecommitdiffstats
path: root/tests/test_ipaserver/test_ldap.py
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2013-01-16 14:14:58 +0100
committerMartin Kosek <mkosek@redhat.com>2013-03-01 16:59:42 +0100
commitef1cd6e24732e7fa64f6c4b0ce32a909fbf1df5d (patch)
tree84ad0688b942996dd7b8fa58af3e2702b92f85d2 /tests/test_ipaserver/test_ldap.py
parente2120c31c3ba62d1bc57825b90a30d26ca58aa79 (diff)
downloadfreeipa-ef1cd6e24732e7fa64f6c4b0ce32a909fbf1df5d.tar.gz
freeipa-ef1cd6e24732e7fa64f6c4b0ce32a909fbf1df5d.tar.xz
freeipa-ef1cd6e24732e7fa64f6c4b0ce32a909fbf1df5d.zip
Add custom mapping object for LDAP entry data.
Diffstat (limited to 'tests/test_ipaserver/test_ldap.py')
-rw-r--r--tests/test_ipaserver/test_ldap.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/test_ipaserver/test_ldap.py b/tests/test_ipaserver/test_ldap.py
index cd3ba3cd5..872d69f01 100644
--- a/tests/test_ipaserver/test_ldap.py
+++ b/tests/test_ipaserver/test_ldap.py
@@ -27,7 +27,7 @@
import nose
import os
-from ipaserver.plugins.ldap2 import ldap2
+from ipaserver.plugins.ldap2 import ldap2, LDAPEntry
from ipalib.plugins.service import service, service_show
from ipalib.plugins.host import host
import nss.nss as nss
@@ -145,3 +145,30 @@ class test_ldap(object):
cert = cert[0]
serial = unicode(x509.get_serial_number(cert, x509.DER))
assert serial is not None
+
+ def test_entry(self):
+ """
+ Test the LDAPEntry class
+ """
+ cn1 = [u'test1']
+ cn2 = [u'test2']
+ dn1 = DN(('cn', cn1[0]))
+ dn2 = DN(('cn', cn2[0]))
+
+ e = LDAPEntry(dn1, cn=cn1)
+ assert e.dn is dn1
+ assert 'CN' in e
+ assert e['CN'] is cn1
+ assert e['CN'] is e[u'cn']
+
+ e.dn = dn2
+ assert e.dn is dn2
+
+ e['cn'] = cn2
+ assert 'CN' in e
+ assert e['CN'] is cn2
+ assert e['CN'] is e[u'cn']
+
+ del e['CN']
+ assert 'CN' not in e
+ assert u'cn' not in e