aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/auth-source-tests.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/lisp/auth-source-tests.el b/test/lisp/auth-source-tests.el
index eb93f7488e4..c1ee9093744 100644
--- a/test/lisp/auth-source-tests.el
+++ b/test/lisp/auth-source-tests.el
@@ -289,5 +289,25 @@
289 (should (equal found-as-string (concat testname ": " needed))))) 289 (should (equal found-as-string (concat testname ": " needed)))))
290 (delete-file netrc-file))) 290 (delete-file netrc-file)))
291 291
292(ert-deftest auth-source-delete ()
293 (let* ((netrc-file (make-temp-file "auth-source-test" nil nil "\
294machine a1 port a2 user a3 password a4
295machine b1 port b2 user b3 password b4
296machine c1 port c2 user c3 password c4\n"))
297 (auth-sources (list netrc-file))
298 (auth-source-do-cache nil)
299 (expected '((:host "a1" :port "a2" :user "a3" :secret "a4")))
300 (parameters '(:max 1 :host t)))
301 (unwind-protect
302 (let ((found (apply #'auth-source-delete parameters)))
303 (dolist (f found)
304 (let ((s (plist-get f :secret)))
305 (setf f (plist-put f :secret
306 (if (functionp s) (funcall s) s)))))
307 ;; Note: The netrc backend doesn't delete anything, so
308 ;; this is actually the same as `auth-source-search'.
309 (should (equal found expected)))
310 (delete-file netrc-file))))
311
292(provide 'auth-source-tests) 312(provide 'auth-source-tests)
293;;; auth-source-tests.el ends here 313;;; auth-source-tests.el ends here