tools/password-store: fix emacs 26 compatibility
This commit is contained in:
parent
41751aca44
commit
3bc0b18184
2 changed files with 30 additions and 18 deletions
|
@ -1,10 +1,12 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; tools/password-store/test/autoload-pass.el
|
||||
|
||||
(load! ../autoload)
|
||||
|
||||
(defmacro -with-passwords! (buffer-args &rest body)
|
||||
(declare (indent defun))
|
||||
`(cl-letf
|
||||
(((symbol-function 'auth-pass-parse-entry)
|
||||
(((symbol-function '+pass--get-entry)
|
||||
(lambda (entry)
|
||||
(when (equal entry "fake/source")
|
||||
'((secret . "defuse-account-gad")
|
||||
|
@ -17,17 +19,22 @@
|
|||
;;
|
||||
(def-test! get-field
|
||||
(-with-passwords!
|
||||
(should (equal (+pass-get-field "fake/source" "login")
|
||||
"HL2532-GANDI"))
|
||||
(should (equal (+pass-get-field "fake/source" "email")
|
||||
"henrik@lissner.net"))
|
||||
(should (equal (+pass-get-field "fake/source" '("alt-login" "email"))
|
||||
"hlissner"))
|
||||
(should (equal (+pass-get-field "fake/source" '("username" "email"))
|
||||
"henrik@lissner.net"))
|
||||
(should-not (+pass-get-field "fake/source" '("x" "y" "z")))
|
||||
(should (equal (+pass-get-field "fake/source" "login")
|
||||
"HL2532-GANDI"))
|
||||
(should (equal (+pass-get-field "fake/source" "email")
|
||||
"henrik@lissner.net"))
|
||||
(should (equal (+pass-get-field "fake/source" '("alt-login" "email"))
|
||||
"hlissner"))
|
||||
(should (equal (+pass-get-field "fake/source" '("username" "email"))
|
||||
"henrik@lissner.net"))))
|
||||
|
||||
(should-error (+pass-get-field "nonexistent/source" "login"))))
|
||||
(def-test! missing-fields-return-nil
|
||||
(-with-passwords!
|
||||
(should-not (+pass-get-field "fake/source" '("x" "y" "z")))))
|
||||
|
||||
(def-test! missing-entries-throw-error
|
||||
(-with-passwords!
|
||||
(should-error (+pass-get-field "nonexistent/source" "login"))))
|
||||
|
||||
(def-test! get-login
|
||||
(-with-passwords!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue