summaryrefslogtreecommitdiffstats
path: root/internal/smtpclient/client_test.go
blob: 6572f9ada6805317d315fee36d53572dd6c4c794 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package smtpclient

import "testing"

func TestValidateOnionRequiresProxy(t *testing.T) {
	err := validate(Config{Host: "mail.example.onion", Port: "465", Mode: "TLS", ProxyType: "DIRECT"}, "a@example.org", []string{"news@example.org"})
	if err == nil {
		t.Fatal("expected onion proxy validation error")
	}
}

func TestValidateAllowsCleartextOnion(t *testing.T) {
	err := validate(Config{Host: "mail.example.onion", Port: "25", Mode: "", ProxyType: "SOCKS5", ProxyAddress: "127.0.0.1:9050"}, "a@example.org", []string{"news@example.org"})
	if err != nil {
		t.Fatalf("cleartext onion SMTP should be allowed: %v", err)
	}
}