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