@@ -38,18 +38,23 @@ class TestIsLDAPUrl(unittest.TestCase):
38
38
'ldap://host.com:6666/o=University%20of%20Michigan,' :1 ,
39
39
'ldap://ldap.itd.umich.edu/c=GB?objectClass?one' :1 ,
40
40
'ldap://ldap.question.com/o=Question%3f,c=US?mail' :1 ,
41
- 'ldap://ldap.netscape.com/o=Babsco,c=US??(int=%5c00%5c00%5c00%5c04)' :1 ,
41
+ 'ldap://ldap.netscape.com/o=Babsco,c=US??? (int=%5c00%5c00%5c00%5c04)' :1 ,
42
42
'ldap:///??sub??bindname=cn=Manager%2co=Foo' :1 ,
43
43
'ldap:///??sub??!bindname=cn=Manager%2co=Foo' :1 ,
44
44
# More examples from various sources
45
45
'ldap://ldap.nameflow.net:1389/c%3dDE' :1 ,
46
46
'ldap://root.openldap.org/dc=openldap,dc=org' :1 ,
47
- 'ldap ://root.openldap.org/dc=openldap,dc=org' :1 ,
47
+ 'ldaps ://root.openldap.org/dc=openldap,dc=org' :1 ,
48
48
'ldap://x500.mh.se/o=Mitthogskolan,c=se????1.2.752.58.10.2=T.61' :1 ,
49
49
'ldp://root.openldap.org/dc=openldap,dc=org' :0 ,
50
50
'ldap://localhost:1389/ou%3DUnstructured%20testing%20tree%2Cdc%3Dstroeder%2Cdc%3Dcom??one' :1 ,
51
51
'ldaps://ldap.example.com/c%3dDE' :1 ,
52
52
'ldapi:///dc=stroeder,dc=de????x-saslmech=EXTERNAL' :1 ,
53
+ 'LDAP://localhost' : True ,
54
+ 'LDAPS://localhost' : True ,
55
+ 'LDAPI://%2Frun%2Fldap.sock' : True ,
56
+ ' ldap://space.example' : False ,
57
+ 'ldap ://space.example' : False ,
53
58
}
54
59
55
60
def test_isLDAPUrl (self ):
@@ -61,6 +66,11 @@ def test_isLDAPUrl(self):
61
66
ldap_url , result , expected ,
62
67
)
63
68
)
69
+ if expected :
70
+ LDAPUrl (ldapUrl = ldap_url )
71
+ else :
72
+ with self .assertRaises (Exception ):
73
+ LDAPUrl (ldapUrl = ldap_url )
64
74
65
75
66
76
class TestParseLDAPUrl (unittest .TestCase ):
@@ -149,6 +159,22 @@ class TestParseLDAPUrl(unittest.TestCase):
149
159
dn = 'dc=stroeder,dc=com' ,
150
160
),
151
161
),
162
+ (
163
+ 'LDAPS://localhost:12345/dc=stroeder,dc=com' ,
164
+ LDAPUrl (
165
+ urlscheme = 'ldaps' ,
166
+ hostport = 'localhost:12345' ,
167
+ dn = 'dc=stroeder,dc=com' ,
168
+ ),
169
+ ),
170
+ (
171
+ 'ldaps://localhost:12345/dc=stroeder,dc=com' ,
172
+ LDAPUrl (
173
+ urlscheme = 'LDAPS' ,
174
+ hostport = 'localhost:12345' ,
175
+ dn = 'dc=stroeder,dc=com' ,
176
+ ),
177
+ ),
152
178
(
153
179
'ldapi://%2ftmp%2fopenldap2-1389/dc=stroeder,dc=com' ,
154
180
LDAPUrl (
0 commit comments