-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathptr_records_test.go
116 lines (87 loc) · 1.65 KB
/
ptr_records_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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package vscale_api_go
import (
"testing"
)
var PTRRecordContent string = "example.com"
var PTRRecordIP string = "95.213.195.160"
var PTRRecordID int64 = 2293
func TestPTRRecordService_Create(t *testing.T) {
token, err := GetToken()
if err != nil {
t.Error(err)
return
}
client := NewClient(token)
ptrRecord, _, err := client.PTRRecord.Create("123123", "1232")
if err != nil {
t.Error(err)
return
}
if ptrRecord.ID == 0 {
t.Error("PTR record id can't be empty")
}
return
}
func TestPTRRecordService_List(t *testing.T) {
token, err := GetToken()
if err != nil {
t.Error(err)
return
}
client := NewClient(token)
_, _, err = client.PTRRecord.List()
if err != nil {
t.Error(err)
return
}
return
}
func TestPTRRecordService_Get(t *testing.T) {
token, err := GetToken()
if err != nil {
t.Error(err)
return
}
client := NewClient(token)
record, _, err := client.PTRRecord.Get(PTRRecordID)
if err != nil {
t.Error(err)
return
}
if record.ID == 0 {
t.Error("Record ID can't be empty")
return
}
return
}
func TestPTRRecordService_Update(t *testing.T) {
token, err := GetToken()
if err != nil {
t.Error(err)
return
}
client := NewClient(token)
ptrRecord, _, err := client.PTRRecord.Update(PTRRecordID, "example2.com", PTRRecordIP)
if err != nil {
t.Error(err)
return
}
if ptrRecord.ID == 0 {
t.Error("PTR record id can't be empty")
}
return
}
func TestPTRRecordService_Remove(t *testing.T) {
token, err := GetToken()
if err != nil {
t.Error(err)
return
}
client := NewClient(token)
_, _, err = client.PTRRecord.Remove(PTRRecordID)
if err != nil {
t.Error(err)
return
}
return
}