-
Notifications
You must be signed in to change notification settings - Fork 0
/
whois_test.go
46 lines (35 loc) · 846 Bytes
/
whois_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
package whois
import (
"strings"
"testing"
)
const (
exampleCom = "example.com"
rockersSu = "rockers.su"
)
var exampleComOut = `% IANA WHOIS server
% for more information on IANA, visit http://www.iana.org
% This query returned 1 object
domain: EXAMPLE.COM
organisation: Internet Assigned Numbers Authority
created: 1992-01-01
source: IANA
`
func TestExampleCom(t *testing.T) {
out, err := Query(IANASever, exampleCom)
if err != nil {
t.Errorf("Query() error: %s", err)
}
if strings.Compare(exampleComOut, out) != 0 {
t.Errorf("output differs: %v %v", exampleComOut, out)
}
}
func TestRockersSu(t *testing.T) {
out, err := QueryAll(rockersSu)
if err != nil {
t.Errorf("QueryAll() error: %s", err)
}
if strings.Contains(out, "TCI") != true {
t.Errorf("output does not contains TCI: %v", out)
}
}