oficina / meet Public

Clone
git clone https://amadan.net/oficina/meet

Plain git — no account needed to clone.

Download

Download this file

1package calls
2
3import (
4 "strings"
5 "testing"
6)
7
8// TestNoMailRefusesOutsideDevelopment is the third boot of CARLOS mail
9// submission (cmd/calls mail_test.go has the other two): with neither
10// channel, cmd/calls passes a nil Mailer, and resolve refuses anywhere
11// but development, naming both ways to fix it.
12func TestNoMailRefusesOutsideDevelopment(t *testing.T) {
13 cfg := minimalConfig(t)
14 cfg.Mailer = nil
15 _, err := resolve(cfg)
16 if err == nil {
17 t.Fatal("started with no mail in production")
18 }
19 for _, want := range []string{"CARLOS_MAIL=submit", "CALLS_SMTP_HOST"} {
20 if !strings.Contains(err.Error(), want) {
21 t.Errorf("refusal %q does not name %s", err, want)
22 }
23 }
24 cfg.Env = EnvDevelopment
25 if _, err := resolve(cfg); err != nil {
26 t.Fatalf("development with no mail: %v", err)
27 }
28}
29