EUDC: Add LDAP tests
* test/lisp/net/eudc-resources/slapd.conf: New file. * test/lisp/net/eudc-resources/dc=gnu,dc=org.ldif: Likewise. * test/lisp/net/eudc-resources/dc=gnu,dc=org: New files. * test/lisp/net/eudc-tests.el (eudcb-ldap): New test.
This commit is contained in:
parent
b18d4dbe0d
commit
a6ae13af42
5 changed files with 78 additions and 0 deletions
15
test/lisp/net/eudc-resources/dc=gnu,dc=org.ldif
Normal file
15
test/lisp/net/eudc-resources/dc=gnu,dc=org.ldif
Normal file
|
@ -0,0 +1,15 @@
|
|||
# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.
|
||||
# CRC32 12f0e8c3
|
||||
dn: dc=gnu
|
||||
objectClass: dcObject
|
||||
objectClass: organization
|
||||
dc: gnu
|
||||
o: The ldap.gnu.org organization
|
||||
description: An organization for the following person
|
||||
structuralObjectClass: organization
|
||||
entryUUID: 43dd74ec-fc0d-103c-8d5c-7dbac5615d14
|
||||
creatorsName:
|
||||
createTimestamp: 20221119042038Z
|
||||
entryCSN: 20221119042038.100000Z#000000#000#000000
|
||||
modifiersName:
|
||||
modifyTimestamp: 20221119042038Z
|
|
@ -0,0 +1,17 @@
|
|||
# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.
|
||||
# CRC32 a33c0168
|
||||
dn: cn=emacs-ert-test-1
|
||||
objectClass: OpenLDAPperson
|
||||
cn: emacs-ert-test-1
|
||||
description:: RW1hY3Mg
|
||||
uid: 1
|
||||
sn: ERT1
|
||||
givenName: Emacs
|
||||
mail: emacs-ert-test-1@ldap.gnu.org
|
||||
structuralObjectClass: OpenLDAPperson
|
||||
entryUUID: 43dd805e-fc0d-103c-8d5d-7dbac5615d14
|
||||
creatorsName:
|
||||
createTimestamp: 20221119042038Z
|
||||
entryCSN: 20221119042038.100350Z#000000#000#000000
|
||||
modifiersName:
|
||||
modifyTimestamp: 20221119042038Z
|
|
@ -0,0 +1,17 @@
|
|||
# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.
|
||||
# CRC32 56119237
|
||||
dn: cn=emacs-ert-test-2
|
||||
objectClass: OpenLDAPperson
|
||||
cn: emacs-ert-test-2
|
||||
description:: RW1hY3Mg
|
||||
uid: 2
|
||||
sn: ERT2
|
||||
givenName: Emacs
|
||||
mail: emacs-ert-test-2@ldap.gnu.org
|
||||
structuralObjectClass: OpenLDAPperson
|
||||
entryUUID: 43dd92b0-fc0d-103c-8d5e-7dbac5615d14
|
||||
creatorsName:
|
||||
createTimestamp: 20221119042038Z
|
||||
entryCSN: 20221119042038.100819Z#000000#000#000000
|
||||
modifiersName:
|
||||
modifyTimestamp: 20221119042038Z
|
7
test/lisp/net/eudc-resources/slapd.conf
Normal file
7
test/lisp/net/eudc-resources/slapd.conf
Normal file
|
@ -0,0 +1,7 @@
|
|||
include /etc/ldap/schema/core.schema
|
||||
include /etc/ldap/schema/cosine.schema
|
||||
include /etc/ldap/schema/inetorgperson.schema
|
||||
include /etc/ldap/schema/openldap.schema
|
||||
database ldif
|
||||
directory eudc-resources
|
||||
suffix "dc=gnu,dc=org"
|
|
@ -267,5 +267,27 @@
|
|||
'(((email . "Lars Ingebrigtsen <larsi@mail-abbrev.com>, \
|
||||
Karl Fogel <kfogel@mail-abbrev.com")))))))))
|
||||
|
||||
(require 'ldap)
|
||||
(ert-deftest eudcb-ldap ()
|
||||
"Test the LDAP back-end."
|
||||
(when (and (file-exists-p "/usr/sbin/slapd")
|
||||
(file-exists-p "/usr/bin/ldapsearch"))
|
||||
(cd (concat (ert-resource-directory) ".."))
|
||||
(let ((ldap-process
|
||||
(start-process "slapd" "*slapd*" "/usr/sbin/slapd"
|
||||
"-h" "ldap://127.0.0.1:3899" "-d" "0" "-4"
|
||||
"-f" (ert-resource-file "slapd.conf")))
|
||||
(ldap-host-parameters-alist '(("ldap://localhost:3899"
|
||||
base "dc=gnu,dc=org" auth simple)))
|
||||
(eudc-server-hotlist '(("ldap://localhost:3899" . ldap)))
|
||||
(eudc-ignore-options-file t))
|
||||
(sleep-for 1) ; Wait for slapd to start.
|
||||
(should (equal (with-temp-buffer
|
||||
(insert "emacs-ert-test-1")
|
||||
(eudc-expand-try-all)
|
||||
(buffer-string))
|
||||
"Emacs ERT1 <emacs-ert-test-1@ldap.gnu.org>"))
|
||||
(kill-process ldap-process))))
|
||||
|
||||
(provide 'eudc-tests)
|
||||
;;; eudc-tests.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue