-
Notifications
You must be signed in to change notification settings - Fork 3
/
parser_co_jp_test.go
38 lines (32 loc) · 1.38 KB
/
parser_co_jp_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
package whoisparser
import (
"github.com/stretchr/testify/assert"
"io/ioutil"
"testing"
)
func TestParserCoJp(t *testing.T) {
var fileBytes []byte
var err error
var text string
var whoisInfo *Record
fileBytes, err = ioutil.ReadFile("test_data/whois_co_jp/jal.co.jp.txt")
assert.NoError(t, err, "failed to open file with test data")
text = string(fileBytes)
whoisInfo = coJpParser.Parse(text)
assert.NoError(t, err, "failed to open file with test data")
assert.Contains(t, whoisInfo.Registrar.DomainName, "JAL.CO.JP")
assert.Contains(t, whoisInfo.Registrar.CreatedDate, "1994/08/04")
assert.Contains(t, whoisInfo.Registrar.ExpirationDate, "Connected (2020/08/31)")
assert.Len(t, whoisInfo.Registrar.NameServers, 45)
assert.Contains(t, whoisInfo.Registrar.NameServers, "dns-a.iij.ad.jp")
assert.Contains(t, whoisInfo.Registrar.NameServers, "ns01.jal.co.jp")
assert.Contains(t, whoisInfo.Registrar.NameServers, "ns02.jal.co.jp")
assert.Contains(t, whoisInfo.Registrar.UpdatedDate, "2019/09/01 01:07:02 (JST)")
assert.Equal(t, whoisInfo.Registrant.Organization, "Japan Airlines Co., Ltd.")
assert.Equal(t, whoisInfo.Admin.ID, "YS32616JP")
assert.Len(t, whoisInfo.Tech.ID, 38)
assert.Contains(t, whoisInfo.Tech.ID, "TK22256JP")
assert.Contains(t, whoisInfo.Tech.ID, "KT15543JP")
assert.Contains(t, whoisInfo.Tech.ID, "MY9415JP")
assert.Contains(t, whoisInfo.Tech.ID, "SK12923JP")
}