-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_test.go
79 lines (67 loc) · 2.14 KB
/
client_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
package dusupay
import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"testing"
)
type ClientTestSuite struct {
suite.Suite
}
func (suite *ClientTestSuite) TestNewClientFromConfigValid() {
cfg := BuildStubConfig()
client, err := NewClientFromConfig(cfg, nil)
assert.NoError(suite.T(), err)
assert.NotEmpty(suite.T(), client)
}
func (suite *ClientTestSuite) TestNewClientFromConfigInvalid() {
cfg := BuildStubConfig()
cfg.Uri = ""
client, err := NewClientFromConfig(cfg, nil)
assert.Error(suite.T(), err)
assert.Empty(suite.T(), client)
}
func (suite *ClientTestSuite) TestGetCollectionsResource() {
client, err := NewClientFromConfig(BuildStubConfig(), nil)
result := client.Collections()
assert.NoError(suite.T(), err)
assert.NotEmpty(suite.T(), result)
}
func (suite *ClientTestSuite) TestGetPayoutsResource() {
client, err := NewClientFromConfig(BuildStubConfig(), nil)
result := client.Payouts()
assert.NoError(suite.T(), err)
assert.NotEmpty(suite.T(), result)
}
func (suite *ClientTestSuite) TestGetProvidersResource() {
client, err := NewClientFromConfig(BuildStubConfig(), nil)
result := client.Providers()
assert.NoError(suite.T(), err)
assert.NotEmpty(suite.T(), result)
}
func (suite *ClientTestSuite) TestGetMerchantsResource() {
client, err := NewClientFromConfig(BuildStubConfig(), nil)
result := client.Merchants()
assert.NoError(suite.T(), err)
assert.NotEmpty(suite.T(), result)
}
func (suite *ClientTestSuite) TestGetRefundsResource() {
client, err := NewClientFromConfig(BuildStubConfig(), nil)
result := client.Refunds()
assert.NoError(suite.T(), err)
assert.NotEmpty(suite.T(), result)
}
func (suite *ClientTestSuite) TestGetBanksResource() {
client, err := NewClientFromConfig(BuildStubConfig(), nil)
result := client.Banks()
assert.NoError(suite.T(), err)
assert.NotEmpty(suite.T(), result)
}
func (suite *ClientTestSuite) TestGetWebhooksResource() {
client, err := NewClientFromConfig(BuildStubConfig(), nil)
result := client.Webhooks()
assert.NoError(suite.T(), err)
assert.NotEmpty(suite.T(), result)
}
func TestClientTestSuite(t *testing.T) {
suite.Run(t, new(ClientTestSuite))
}