aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorŁukasz Jędrzejewski2017-11-04 12:24:49 +0200
committerEli Zaretskii2017-11-04 12:24:49 +0200
commite973c5f5f43ad4d6c98995eea269509b8a258781 (patch)
tree37c59af9480865ab5dad813a54ff8f0979b3667d /test
parent5ea5b2536ef580fe4b17b6dbd62df90d51e73e5f (diff)
downloademacs-e973c5f5f43ad4d6c98995eea269509b8a258781.tar.gz
emacs-e973c5f5f43ad4d6c98995eea269509b8a258781.zip
Extract user from host when searching for entries in auth-source-pass
* lisp/auth-source-pass.el (auth-source-pass--user): New function. (auth-source-pass--find-match): Use it. When the user is not explicitly specified and no entry is found, extract the user from the host and then search again. (Bug#29045) * test/lisp/auth-source-pass-tests.el (auth-source-pass-find-match-matching-extracting-user-from-host): Add a new test case. Copyright-paperwork-exempt: yes
Diffstat (limited to 'test')
-rw-r--r--test/lisp/auth-source-pass-tests.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/lisp/auth-source-pass-tests.el b/test/lisp/auth-source-pass-tests.el
index 9b6b5687cab..84423b7d06d 100644
--- a/test/lisp/auth-source-pass-tests.el
+++ b/test/lisp/auth-source-pass-tests.el
@@ -128,6 +128,11 @@ This function is intended to be set to `auth-source-debug`."
128 (should (equal (auth-source-pass--find-match "foo.bar.com" nil) 128 (should (equal (auth-source-pass--find-match "foo.bar.com" nil)
129 nil)))) 129 nil))))
130 130
131(ert-deftest auth-source-pass-find-match-matching-extracting-user-from-host ()
132 (auth-source-pass--with-store '(("foo.com/bar"))
133 (should (equal (auth-source-pass--find-match "https://bar@foo.com" nil)
134 "foo.com/bar"))))
135
131(ert-deftest auth-source-pass-search-with-user-first () 136(ert-deftest auth-source-pass-search-with-user-first ()
132 (auth-source-pass--with-store '(("foo") ("user@foo")) 137 (auth-source-pass--with-store '(("foo") ("user@foo"))
133 (should (equal (auth-source-pass--find-match "foo" "user") 138 (should (equal (auth-source-pass--find-match "foo" "user")