summaryrefslogtreecommitdiff
path: root/test/lisp/erc/erc-sasl-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/erc/erc-sasl-tests.el')
-rw-r--r--test/lisp/erc/erc-sasl-tests.el31
1 files changed, 16 insertions, 15 deletions
diff --git a/test/lisp/erc/erc-sasl-tests.el b/test/lisp/erc/erc-sasl-tests.el
index 64593ca270c..3e6828ff644 100644
--- a/test/lisp/erc/erc-sasl-tests.el
+++ b/test/lisp/erc/erc-sasl-tests.el
@@ -42,17 +42,17 @@
(erc-sasl--options '((password . :password))))
(should (string= (erc-sasl--read-password nil) "foo"))))
- (ert-info ("Fallback to prompt skip auth-source")
- (should-not erc-sasl-auth-source-function)
- (let ((erc-session-password "bar")
- (erc-networks--id (erc-networks--id-create nil)))
+ (ert-info ("Prompt when no authfn and :password resolves to nil")
+ (let ((erc-session-password nil)
+ (erc-sasl--options
+ '((password . :password) (user . :user) (authfn))))
(should (string= (ert-simulate-keys "bar\r"
(erc-sasl--read-password "?"))
"bar"))))
- (ert-info ("Prompt when auth-source fails and `erc-sasl-password' null")
- (let ((erc-sasl--options '((password)))
- (erc-sasl-auth-source-function #'ignore))
+ (ert-info ("Prompt when auth-source fails and `erc-session-password' null")
+ (should-not erc-session-password)
+ (let ((erc-sasl--options '((password) (authfn . ignore))))
(should (string= (ert-simulate-keys "baz\r"
(erc-sasl--read-password "pwd:"))
"baz")))))
@@ -71,36 +71,37 @@
(erc-session-port 6697)
(erc-networks--id (erc-networks--id-create nil))
calls
- (erc-sasl-auth-source-function
- (lambda (&rest r)
- (push r calls)
- (apply #'erc--auth-source-search r)))
+ (fn (lambda (&rest r)
+ (push r calls)
+ (apply #'erc-auth-source-search r)))
erc-server-announced-name ; too early
auth-source-do-cache)
(ert-info ("Symbol as password specifies machine")
- (let ((erc-sasl--options '((user . "bob") (password . FSF.chat)))
+ (let ((erc-sasl--options
+ `((user . "bob") (password . FSF.chat) (authfn . ,fn)))
(erc-networks--id (make-erc-networks--id)))
(should (string= (erc-sasl--read-password nil) "sesame"))
(should (equal (pop calls) '(:user "bob" :host "FSF.chat")))))
(ert-info ("ID for :host and `erc-session-username' for :user") ; *1
(let ((erc-session-username "bob")
- (erc-sasl--options '((user . :user) (password)))
+ (erc-sasl--options `((user . :user) (password) (authfn . ,fn)))
(erc-networks--id (erc-networks--id-create 'GNU/chat)))
(should (string= (erc-sasl--read-password nil) "spam"))
(should (equal (pop calls) '(:user "bob" :host "GNU/chat")))))
(ert-info ("ID for :host and current nick for :user") ; *1
(let ((erc-server-current-nick "bob")
- (erc-sasl--options '((user . :nick) (password)))
+ (erc-sasl--options `((user . :nick) (password) (authfn . ,fn)))
(erc-networks--id (erc-networks--id-create 'GNU/chat)))
(should (string= (erc-sasl--read-password nil) "spam"))
(should (equal (pop calls) '(:user "bob" :host "GNU/chat")))))
(ert-info ("Symbol as password, entry lacks user field")
(let ((erc-server-current-nick "fake")
- (erc-sasl--options '((user . :nick) (password . MyHost)))
+ (erc-sasl--options
+ `((user . :nick) (password . MyHost) (authfn . ,fn)))
(erc-networks--id (erc-networks--id-create 'GNU/chat)))
(should (string= (erc-sasl--read-password nil) "123"))
(should (equal (pop calls) '(:user "fake" :host "MyHost"))))))))