Refactor and fix unit tests, plus isolate them better
This commit is contained in:
parent
5c74814860
commit
8ad2666f8f
14 changed files with 146 additions and 117 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
(load! ../autoload)
|
||||
|
||||
(defmacro -with-passwords! (buffer-args &rest body)
|
||||
(defmacro with-passwords!! (buffer-args &rest body)
|
||||
(declare (indent defun))
|
||||
`(cl-letf
|
||||
(((symbol-function '+pass--get-entry)
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
;;
|
||||
(def-test! get-field
|
||||
(-with-passwords!
|
||||
(with-passwords!!
|
||||
(should (equal (+pass-get-field "fake/source" "login")
|
||||
"HL2532-GANDI"))
|
||||
(should (equal (+pass-get-field "fake/source" "email")
|
||||
|
@ -29,14 +29,14 @@
|
|||
"henrik@lissner.net"))))
|
||||
|
||||
(def-test! missing-fields-return-nil
|
||||
(-with-passwords!
|
||||
(with-passwords!!
|
||||
(should-not (+pass-get-field "fake/source" '("x" "y" "z")))))
|
||||
|
||||
(def-test! missing-entries-throw-error
|
||||
(-with-passwords!
|
||||
(with-passwords!!
|
||||
(should-error (+pass-get-field "nonexistent/source" "login"))))
|
||||
|
||||
(def-test! get-login
|
||||
(-with-passwords!
|
||||
(with-passwords!!
|
||||
(should (equal (+pass-get-user "fake/source") "HL2532-GANDI"))
|
||||
(should (equal (+pass-get-secret "fake/source") "defuse-account-gad"))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue