-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_test.go
42 lines (35 loc) · 1.01 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
package fasapay
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) TestGetAccountsResource() {
client, _ := NewClientFromConfig(BuildStubConfig(), nil)
result := client.Accounts()
assert.NotEmpty(suite.T(), result)
}
func (suite *ClientTestSuite) TestGetTransfersResource() {
client, _ := NewClientFromConfig(BuildStubConfig(), nil)
result := client.Transfers()
assert.NotEmpty(suite.T(), result)
}
func TestClientTestSuite(t *testing.T) {
suite.Run(t, new(ClientTestSuite))
}