From 2ec39734ca03e075f2515f178ed789872e52f98f Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Sat, 19 Nov 2022 11:39:21 -0500 Subject: EUDC: Add BBDB test * test/lisp/net/eudc-tests.el (eudcb-ldap): Call skip-unless with slapd check. (eudcb-bbdb): New test. --- test/lisp/net/eudc-resources/bbdb | 3 +++ test/lisp/net/eudc-tests.el | 54 ++++++++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 test/lisp/net/eudc-resources/bbdb (limited to 'test/lisp/net') 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 ")) - (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 ")) + (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 ")))) (provide 'eudc-tests) ;;; eudc-tests.el ends here -- cgit v1.2.3