From 0a1e520048db007b31515de0941c26fd0673abed Mon Sep 17 00:00:00 2001 From: stroeder Date: Sun, 19 Nov 2017 18:00:49 +0000 Subject: [PATCH] added ldap.dn tests with ldap.DN_FORMAT_LDAPV2 --- Tests/t_ldap_dn.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tests/t_ldap_dn.py b/Tests/t_ldap_dn.py index 9a3c54a..97274f3 100644 --- a/Tests/t_ldap_dn.py +++ b/Tests/t_ldap_dn.py @@ -78,6 +78,15 @@ def test_str2dn(self): [('dc', 'com', 1)] ] ) + self.assertEqual( + ldap.dn.str2dn('uid=test42; ou=Testing; dc=example; dc=com', flags=ldap.DN_FORMAT_LDAPV2), + [ + [('uid', 'test42', 1)], + [('ou', 'Testing', 1)], + [('dc', 'example', 1)], + [('dc', 'com', 1)] + ] + ) self.assertEqual( ldap.dn.str2dn('uid=test\\, 42,ou=Testing,dc=example,dc=com', flags=0), [ @@ -175,6 +184,10 @@ def test_explode_dn(self): ldap.dn.explode_dn('uid=test42,ou=Testing,dc=example,dc=com', flags=0), ['uid=test42', 'ou=Testing', 'dc=example', 'dc=com'] ) + self.assertEqual( + ldap.dn.explode_dn('uid=test42; ou=Testing; dc=example; dc=com', flags=ldap.DN_FORMAT_LDAPV2), + ['uid=test42', 'ou=Testing', 'dc=example', 'dc=com'] + ) self.assertEqual( ldap.dn.explode_dn('uid=test42,ou=Testing,dc=example,dc=com', notypes=True), ['test42', 'Testing', 'example', 'com']