summaryrefslogtreecommitdiffstats
path: root/ipatests
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2016-05-06 18:27:24 +0200
committerMartin Basti <mbasti@redhat.com>2016-05-30 16:44:08 +0200
commit037eae26d0cd8467d3a559bb4cc585c61b626734 (patch)
treeb4c96e669f3e3fec84512cf3fcc6879a19b1e669 /ipatests
parentc192c1ae3e080597995b906d93cc7607ffc605c0 (diff)
downloadfreeipa-037eae26d0cd8467d3a559bb4cc585c61b626734.tar.gz
freeipa-037eae26d0cd8467d3a559bb4cc585c61b626734.tar.xz
freeipa-037eae26d0cd8467d3a559bb4cc585c61b626734.zip
test_ipaserver.test_ldap: Adjust tests to Python 3's KeyView
In Python 3, the keys() method of mappings returns a KeyView object that reflects the mapping's state. In LDAPEntry, this means that the collection returned by keys() is case-insensitive and supports aliases. Part of the fix for: https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r--ipatests/test_ipaserver/test_ldap.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/ipatests/test_ipaserver/test_ldap.py b/ipatests/test_ipaserver/test_ldap.py
index ff1a7c1a5..42245a087 100644
--- a/ipatests/test_ipaserver/test_ldap.py
+++ b/ipatests/test_ipaserver/test_ldap.py
@@ -184,9 +184,15 @@ class test_LDAPEntry(object):
assert u'cn' in e
assert u'cn' in e.keys()
assert 'CN' in e
- assert 'CN' not in e.keys()
+ if six.PY2:
+ assert 'CN' not in e.keys()
+ else:
+ assert 'CN' in e.keys()
assert 'commonName' in e
- assert 'commonName' not in e.keys()
+ if six.PY2:
+ assert 'commonName' not in e.keys()
+ else:
+ assert 'commonName' in e.keys()
assert e['CN'] is self.cn1
assert e['CN'] is e[u'cn']
@@ -199,9 +205,15 @@ class test_LDAPEntry(object):
assert u'cn' in e
assert u'cn' in e.keys()
assert 'CN' in e
- assert 'CN' not in e.keys()
+ if six.PY2:
+ assert 'CN' not in e.keys()
+ else:
+ assert 'CN' in e.keys()
assert 'commonName' in e
- assert 'commonName' not in e.keys()
+ if six.PY2:
+ assert 'commonName' not in e.keys()
+ else:
+ assert 'commonName' in e.keys()
assert e['CN'] is self.cn2
assert e['CN'] is e[u'cn']