srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/internal/proxy/certdownload_test.go
blob: aae5f48407a646f23050ed899764b083fbe3f4cd (plain) (blame)
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)
		}
	}
}