From: Thomas Fitzsimmons <fitzsim@fitzsim.org> Date: Sat, 19 Nov 2022 16:39:21 +0000 (-0500) Subject: EUDC: Add BBDB test X-Git-Tag: emacs-29.0.90~1616^2~24 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2ec39734ca03e075f2515f178ed789872e52f98f;p=emacs.git EUDC: Add BBDB test * test/lisp/net/eudc-tests.el (eudcb-ldap): Call skip-unless with slapd check. (eudcb-bbdb): New test. --- diff --git a/test/lisp/net/eudc-resources/bbdb b/test/lisp/net/eudc-resources/bbdb new file mode 100644 index 00000000000..b730bb51cc9 --- /dev/null +++ b/test/lisp/net/eudc-resources/bbdb @@ -0,0 +1,3 @@ +;; -*- mode: Emacs-Lisp; coding: utf-8; -*- +;;; file-format: 9 +["Emacs" "ERT3" nil nil nil nil nil ("emacs-ert-test-3@bbdb.gnu.org") ((notes . " ")) "c8bd3a63-3a83-48a7-a95b-be118a923e00" "2022-11-19 16:36:04 +0000" "2022-11-19 16:36:04 +0000" nil] diff --git a/test/lisp/net/eudc-tests.el b/test/lisp/net/eudc-tests.el index 59dce55b820..212db65cb26 100644 --- a/test/lisp/net/eudc-tests.el +++ b/test/lisp/net/eudc-tests.el @@ -270,24 +270,42 @@ 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)))) + (skip-unless (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))) + +(eval-and-compile + (push (expand-file-name "../elpa/packages/bbdb/lisp" source-directory) + load-path) + (defvar bbdb-file) + (require 'bbdb nil t)) + +(ert-deftest eudcb-bbdb () + "Test the BBDB back-end." + (skip-unless (featurep 'bbdb)) + (let ((bbdb-file (ert-resource-file "bbdb")) + (eudc-server-hotlist '(("" . bbdb))) + (eudc-ignore-options-file t)) + (should (equal (with-temp-buffer + (insert "emacs-ert-test-3") + (eudc-expand-try-all) + (buffer-string)) + "Emacs ERT3 <emacs-ert-test-3@bbdb.gnu.org>")))) (provide 'eudc-tests) ;;; eudc-tests.el ends here