1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package proxy
import "testing"
func TestIsCertDownloadHost(t *testing.T) {
tests := []struct {
host string
want bool
}{
{"mitmux.cert", true},
{"mitmux.cert:80", true},
{"MITMUX.CERT", true},
{"Mitmux.Cert:8080", true},
{"example.com", false},
{"notmitmux.cert", false},
{"mitmux.cert.evil.com", false},
{"", false},
}
for _, tt := range tests {
if got := isCertDownloadHost(tt.host); got != tt.want {
t.Errorf("isCertDownloadHost(%q) = %v, want %v", tt.host, got, tt.want)
}
}
}
|