/
zone.go
67 lines (60 loc) · 1.74 KB
/
zone.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
package mockns1
import (
"net/http"
"gopkg.in/ns1/ns1-go.v2/rest/model/dns"
)
// AddZoneListTestCase sets up a test case for the api.Client.Zones.List()
// function
func (s *Service) AddZoneListTestCase(
requestHeaders, responseHeaders http.Header,
response []*dns.Zone,
) error {
return s.AddTestCase(
http.MethodGet, "/zones", http.StatusOK, requestHeaders,
responseHeaders, "", response,
)
}
// AddZoneGetTestCase sets up a test case for the api.Client.Zones.Get()
// function
func (s *Service) AddZoneGetTestCase(
name string,
requestHeaders, responseHeaders http.Header,
response *dns.Zone,
) error {
return s.AddTestCase(
http.MethodGet, "/zones/"+name, http.StatusOK, requestHeaders,
responseHeaders, "", response,
)
}
// AddZoneCreateTestCase sets up a test case for the api.Client.Zones.Create()
// function
func (s *Service) AddZoneCreateTestCase(
requestHeaders, responseHeaders http.Header,
zone, response *dns.Zone,
) error {
return s.AddTestCase(
http.MethodPut, "/zones/"+zone.Zone, http.StatusCreated, requestHeaders,
responseHeaders, zone, response,
)
}
// AddZoneUpdateTestCase sets up a test case for the api.Client.Zones.Update()
// function
func (s *Service) AddZoneUpdateTestCase(
requestHeaders, responseHeaders http.Header,
zone, response *dns.Zone,
) error {
return s.AddTestCase(
http.MethodPost, "/zones/"+zone.Zone, http.StatusOK, requestHeaders,
responseHeaders, zone, response,
)
}
// AddZoneDeleteTestCase sets up a test case for the api.Client.Zones.Delete()
// function
func (s *Service) AddZoneDeleteTestCase(
name string, requestHeaders, responseHeaders http.Header,
) error {
return s.AddTestCase(
http.MethodDelete, "/zones/"+name, http.StatusNoContent, requestHeaders,
responseHeaders, "", "",
)
}