-
Notifications
You must be signed in to change notification settings - Fork 23
/
tollfree_verification_test.go
108 lines (86 loc) · 2.92 KB
/
tollfree_verification_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
package plivo
import (
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
func TestTollFreeRequestVerificationServiceCreate(t *testing.T) {
expectResponse("TollFreeRequestVerificationCreateResponse.json", 201)
if _, err := client.TollFreeRequestVerification.Create(TollfreeVerificationCreateParams{}); err != nil {
panic(err)
}
cl := client.httpClient
client.httpClient = nil
_, err := client.TollFreeRequestVerification.Create(TollfreeVerificationCreateParams{})
if err == nil {
client.httpClient = cl
panic(errors.New("error expected"))
}
client.httpClient = cl
assertRequest(t, "POST", "TollfreeVerification")
}
func TestTollFreeRequestVerificationServiceUpdate(t *testing.T) {
expectResponse("TollFreeRequestVerificationUpdateResponse.json", 202)
RequestId := "RequestId"
if _, err := client.TollFreeRequestVerification.Update(RequestId, TollfreeVerificationUpdateParams{}); err != nil {
panic(err)
}
cl := client.httpClient
client.httpClient = nil
_, err := client.TollFreeRequestVerification.Update(RequestId, TollfreeVerificationUpdateParams{})
if err == nil {
client.httpClient = cl
panic(errors.New("error expected"))
}
client.httpClient = cl
assertRequest(t, "POST", "TollfreeVerification/%s", RequestId)
}
func TestTollFreeRequestVerificationServiceList(t *testing.T) {
expectResponse("TollFreeRequestVerificationListResponse.json", 200)
if _, err := client.TollFreeRequestVerification.List(TollfreeVerificationListParams{}); err != nil {
panic(err)
}
cl := client.httpClient
client.httpClient = nil
_, err := client.TollFreeRequestVerification.List(TollfreeVerificationListParams{})
if err == nil {
client.httpClient = cl
panic(errors.New("error expected"))
}
client.httpClient = cl
assertRequest(t, "GET", "TollfreeVerification")
}
func TestTollFreeRequestVerificationServiceGet(t *testing.T) {
expectResponse("TollFreeRequestVerificationGetResponse.json", 200)
RequestId := "RequestId"
TollFreeRequestVerificationRequest, err := client.TollFreeRequestVerification.Get(RequestId)
assert.Equal(t, TollFreeRequestVerificationRequest.ID(), TollFreeRequestVerificationRequest.UUID)
if err != nil {
panic(err)
}
cl := client.httpClient
client.httpClient = nil
_, err = client.TollFreeRequestVerification.Get(RequestId)
if err == nil {
client.httpClient = cl
panic(errors.New("error expected"))
}
client.httpClient = cl
assertRequest(t, "GET", "TollfreeVerification/%s", RequestId)
}
func TestTollFreeRequestVerificationServiceDelete(t *testing.T) {
expectResponse("", 204)
RequestId := "RequestId"
if err := client.TollFreeRequestVerification.Delete(RequestId); err != nil {
panic(err)
}
cl := client.httpClient
client.httpClient = nil
err := client.TollFreeRequestVerification.Delete(RequestId)
if err == nil {
client.httpClient = cl
panic(errors.New("error expected"))
}
client.httpClient = cl
assertRequest(t, "DELETE", "TollfreeVerification/%s", RequestId)
}