:tools password-store -> :tools pass
A simpler name and matches the prefix of its module.
This commit is contained in:
parent
0674e4b4b0
commit
c3cb7c5000
9 changed files with 13 additions and 12 deletions
41
modules/tools/pass/test/test-pass.el
Normal file
41
modules/tools/pass/test/test-pass.el
Normal file
|
@ -0,0 +1,41 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; tools/pass/test/test-pass.el
|
||||
|
||||
(describe "tools/pass"
|
||||
(before-all
|
||||
(load! "../autoload"))
|
||||
|
||||
(before-each
|
||||
(spy-on 'auth-source-pass-parse-entry :and-call-fake
|
||||
(lambda (entry)
|
||||
(when (equal entry "fake/source")
|
||||
'((secret . "defuse-account-gad")
|
||||
("login" . "HL2532")
|
||||
("alt-login" . "hlissner")
|
||||
("email" . "henrik@lissner.net")
|
||||
("url" . "https://some-place.net/login"))))))
|
||||
|
||||
(describe "get field"
|
||||
(it "returns specific fields"
|
||||
(expect (+pass-get-field "fake/source" "email")
|
||||
:to-equal "henrik@lissner.net"))
|
||||
(it "returns first existing of a list of fields"
|
||||
(expect (+pass-get-field "fake/source" '("alt-login" "email"))
|
||||
:to-equal "hlissner")
|
||||
(expect (+pass-get-field "fake/source" '("username" "email"))
|
||||
:to-equal "henrik@lissner.net"))
|
||||
(it "returns nil for missing fields"
|
||||
(expect (+pass-get-field "fake/source" '("x" "y" "z"))
|
||||
:to-be nil))
|
||||
(it "throws error on missing entries"
|
||||
(expect (+pass-get-field "nonexistent/source" "login")
|
||||
:to-throw)))
|
||||
|
||||
(describe "get user/secret"
|
||||
(it "returns the user"
|
||||
(let ((+pass-user-fields '("login" "user" "username" "email")))
|
||||
(expect (+pass-get-user "fake/source")
|
||||
:to-equal "HL2532")))
|
||||
(it "returns the secret"
|
||||
(expect (+pass-get-secret "fake/source")
|
||||
:to-equal "defuse-account-gad"))))
|
Loading…
Add table
Add a link
Reference in a new issue