/
balance_test.go
56 lines (43 loc) · 1.21 KB
/
balance_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
package bankly_test
import (
"context"
"net/http"
"testing"
"time"
"github.com/contbank/bankly-sdk"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
type BalanceTestSuite struct {
suite.Suite
ctx context.Context
assert *assert.Assertions
session *bankly.Session
balance *bankly.Balance
}
func TestBalanceTestSuite(t *testing.T) {
suite.Run(t, new(BalanceTestSuite))
}
func (s *BalanceTestSuite) SetupTest() {
s.assert = assert.New(s.T())
s.ctx = context.Background()
session, err := bankly.NewSession(bankly.Config{
ClientID: bankly.String(*bankly.GetEnvBanklyClientID()),
ClientSecret: bankly.String(*bankly.GetEnvBanklyClientSecret()),
Scopes: bankly.String("account.read"),
})
s.assert.NoError(err)
httpClient := &http.Client{
Timeout: 30 * time.Second,
Transport: bankly.LoggingRoundTripper{Proxied: http.DefaultTransport},
}
s.session = session
s.balance = bankly.NewBalance(httpClient, *s.session)
}
func (s *BalanceTestSuite) TestBalance() {
// TODO Mockar teste
s.T().Skip("O bankly está retornando 500 com o body null. Mockar teste.")
balance, err := s.balance.Balance(s.ctx, "184152")
s.assert.NoError(err)
s.assert.NotNil(balance)
}