all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 94336db07c59c23621ec43b9839e99ad5e27e7d9 2854 bytes (raw)
name: test/lisp/erc/erc-scenarios/erc-scenarios-join-auth-source.el 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
;;; erc-scenarios-join-auth-source.el --- join-auth-source scenarios -*- lexical-binding: t -*-

;; Copyright (C) 2022 Free Software Foundation, Inc.
;;
;; This file is part of GNU Emacs.
;;
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see
;; <https://www.gnu.org/licenses/>.

;;; Commentary:

;; TODO add another test with autojoin and channel keys

(require 'ert-x)
(eval-and-compile
  (let ((load-path (cons (ert-resource-directory) load-path)))
    (require 'erc-scenarios-common)))

(ert-deftest erc-scenarios-join-auth-source--network ()
  :tags '(:expensive-test)
  (should erc-auth-source-join-function)
  (erc-scenarios-common-with-cleanup
      ((entries
        '("machine 127.0.0.1 port %d login \"#foo\" password spam"
          "machine irc.foonet.org port %d login tester password fake"
          "machine irc.foonet.org login \"#spam\" password secret"
          "machine foonet port %d login dummy password fake"
          "machine 127.0.0.1 port %d login dummy password changeme"))
       (erc-scenarios-common-dialog "join/auth-source")
       (erc-server-flood-penalty 0.1)
       (dumb-server (erc-d-run "localhost" t 'foonet))
       (port (process-contact dumb-server :service))
       (ents (mapcar (lambda (fmt) (format fmt port)) entries))
       (netrc-file (make-temp-file "auth-source-test" nil nil
                                   (string-join ents "\n")))
       (auth-sources (list netrc-file))
       (auth-source-do-cache nil)
       (expect (erc-d-t-make-expecter))
       (erc-scenarios-common-extra-teardown (lambda ()
                                              (delete-file netrc-file))))

    (ert-info ("Connect without password")
      (with-current-buffer (erc :server "127.0.0.1"
                                :port port
                                :nick "dummy"
                                :full-name "dummy")
        (should (string= (buffer-name) (format "127.0.0.1:%d" port)))
        (erc-d-t-wait-for 8 (eq erc-network 'foonet))
        (funcall expect 10 "user modes")
        (erc-scenarios-common-say "/JOIN #spam")))

    (ert-info ("Join #spam")
      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#spam"))
        (funcall expect 10 "#spam was created on")))))

;;; erc-scenarios-join-auth-source.el ends here

debug log:

solving 94336db07c ...
found 94336db07c in https://git.savannah.gnu.org/cgit/emacs.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.