-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.rkt
73 lines (65 loc) · 1.98 KB
/
test.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#lang racket/base
(require racket/class
"ldap.rkt")
(module+ test
(require rackunit)
(provide ldap)
(define ldap (new ldap%
[host "ldap://192.168.0.81:389"]
[root-dn "cn=Manager,dc=hz,dc=ru"]
[password "secret"])))
(module+ test-modrdn
(require (submod ".." test))
(send ldap bind)
(send ldap rename-dn
"uid=Dymok,ou=gatos,cn=Manager,dc=hz,dc=ru"
"uid=Dymokhod"
"ou=gatos,cn=Manager,dc=hz,dc=ru"
;; 0: don't delete old value
;; 1: delete old value
1)
(send ldap unbind))
(module+ test-add
(require (submod ".." test))
(send ldap bind)
(send ldap add
"uid=Blanco,ou=gatos,cn=Manager,dc=hz,dc=ru"
'((#x0000 "objectClass" ("inetOrgPerson" "organizationalPerson" "person" "top"))
(#x0000 "sn" ("O Senhor Branco"))
(#x0000 "cn" ("Señor Blanco"))
(#x0000 "description" ("Um bom gatinho branco"))
(#x0000 "mail" ("[email protected]"))))
(send ldap unbind))
(module+ test-modify
(require (submod ".." test))
(send ldap bind)
(send ldap modify
"uid=Dymokhod,ou=gatos,cn=Manager,dc=hz,dc=ru"
'((#x0002 "description" ("El gato gordo"))
(#x0002 "mail" ("[email protected]"))))
(send ldap unbind))
(module+ test-set-password
(require (submod ".." test))
(send ldap bind)
(send ldap set-password
"uid=Blanco,ou=gatos,cn=Manager,dc=hz,dc=ru"
"a+senha+antiga"
"a+senha")
(send ldap unbind))
(module+ test-search
(require (submod ".." test))
(send ldap bind)
(send ldap search
"ou=gatos,cn=Manager,dc=hz,dc=ru"
"(uid=*)" 2)
(send ldap count-entries)
(send ldap get-data)
(send ldap unbind))
(module+ test-compare
(require (submod ".." test))
(send ldap bind)
(send ldap compare
"uid=Blanco,ou=gatos,cn=Manager,dc=hz,dc=ru"
"mail"
(send ldap unbind))