summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2018-09-24 14:37:50 +0100
committerKarolin Seeger <kseeger@samba.org>2018-11-05 12:44:32 +0100
commit1f7757ef4eae87fbc8c35fd2bd5ba9e3e55124ce (patch)
tree9a72970197d76c421cc8fc3741a8ee88fede6959
parent339a86a6a0c6285e34848621a338b794581ec35e (diff)
downloadsamba-1f7757ef4eae87fbc8c35fd2bd5ba9e3e55124ce.tar.gz
lib/ldb/tests: add test for ldb.Dn passed utf8 unicode
object dn format should be a utf8 encoded string Note: Currently this fails in python2 as the c python binding for the dn string param uses PyArg_ParseTupleAndKeywords() with 's' format, this will accept str *or* unicode in the default encoding. The default encoding in python2 is... ascii. Also adding here a knownfail to squash the error produced by the test. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> (cherry picked from commit d1492ab919b19d1ca72f1d7c97ac0ca3bee13a2a)
-rwxr-xr-xlib/ldb/tests/python/api.py4
-rw-r--r--selftest/knownfail2
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py
index e4010960697..0a883961c00 100755
--- a/lib/ldb/tests/python/api.py
+++ b/lib/ldb/tests/python/api.py
@@ -137,6 +137,10 @@ class SimpleLdb(LdbBaseTest):
l = ldb.Ldb(self.url(), flags=self.flags())
self.assertEqual(len(l.search(controls=["paged_results:0:5"])), 0)
+ def test_utf8_ldb_Dn(self):
+ l = ldb.Ldb(self.url(), flags=self.flags())
+ dn = ldb.Dn(l, (b'a=' + b'\xc4\x85\xc4\x87\xc4\x99\xc5\x82\xc5\x84\xc3\xb3\xc5\x9b\xc5\xba\xc5\xbc').decode('utf8'))
+
def test_search_attrs(self):
l = ldb.Ldb(self.url(), flags=self.flags())
self.assertEqual(len(l.search(ldb.Dn(l, ""), ldb.SCOPE_SUBTREE, "(dc=*)", ["dc"])), 0)
diff --git a/selftest/knownfail b/selftest/knownfail
index baf3d57a31a..a122b27ad21 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -349,3 +349,5 @@
# Disabling NTLM means you can't use samr to change the password
^samba.tests.ntlmdisabled.python\(ktest\).ntlmdisabled.NtlmDisabledTests.test_samr_change_password\(ktest\)
^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\)
+# Ldb test api.SimpleLdb.test_utf8_ldb_Dn is expected to fail
+^ldb.python.api.SimpleLdb.test_utf8_ldb_Dn(none)