-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_test.go
56 lines (53 loc) · 1.54 KB
/
main_test.go
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
package main
import (
"testing"
)
func Test_checkIP4Health(t *testing.T) {
type args struct {
list string
}
tests := []struct {
name string
args args
want error
}{
{"working RBL 1 - blacklist", args{"zen.spamhaus.org"}, nil},
{"working RBL 2 - whitelist", args{"swl.spamhaus.org"}, nil},
// {"working RBL 3", args{"b.barracudacentral.org"}, true},
// {"working RBL 4", args{"dnsbl-0.uceprotect.net"}, true},
// {"working RBL 5", args{"bl.spamcop.net"}, true},
{"random domain", args{"www.example.com"}, ErrRBLPositiveFail},
{"non-existant domain", args{"12345.invaliddomain871253659dfd.com"}, ErrRBLPositiveFail},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := checkIP4Health(tt.args.list); got != tt.want {
t.Errorf("checkIP4Health() = %v, want %v", got, tt.want)
}
})
}
}
func Test_checkDomainHealth(t *testing.T) {
type args struct {
list string
}
tests := []struct {
name string
args args
want bool
}{
{"working RBL 1 - blacklist", args{"dbl.spamhaus.org"}, true},
// {"working RBL 3", args{"b.barracudacentral.org"}, true},
// {"working RBL 4", args{"dnsbl-0.uceprotect.net"}, true},
// {"working RBL 5", args{"bl.spamcop.net"}, true},
{"random domain", args{"www.example.com"}, false},
{"non-existant domain", args{"12345.invaliddomain871253659dfd.com"}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := checkDomainHealth(tt.args.list); got != tt.want {
t.Errorf("checkDomainHealth() = %v, want %v", got, tt.want)
}
})
}
}