2022-04-20 05:28:39 +00:00
|
|
|
package max
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAccountService_GetAccountsRequest(t *testing.T) {
|
|
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
|
|
if !ok {
|
|
|
|
t.SkipNow()
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
|
|
client.Auth(key, secret)
|
|
|
|
|
2023-04-11 10:36:10 +00:00
|
|
|
req := client.NewGetAccountsRequest()
|
2022-04-20 05:28:39 +00:00
|
|
|
accounts, err := req.Do(ctx)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NotNil(t, accounts)
|
|
|
|
assert.NotEmpty(t, accounts)
|
|
|
|
|
|
|
|
t.Logf("accounts: %+v", accounts)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAccountService_GetAccountRequest(t *testing.T) {
|
|
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
|
|
if !ok {
|
|
|
|
t.SkipNow()
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
|
|
client.Auth(key, secret)
|
|
|
|
|
2023-04-11 10:33:51 +00:00
|
|
|
req := client.NewGetAccountRequest()
|
2022-04-20 05:28:39 +00:00
|
|
|
req.Currency("twd")
|
|
|
|
account, err := req.Do(ctx)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NotNil(t, account)
|
|
|
|
t.Logf("account: %+v", account)
|
|
|
|
|
2023-04-11 10:33:51 +00:00
|
|
|
req2 := client.NewGetAccountRequest()
|
2022-04-20 05:28:39 +00:00
|
|
|
req2.Currency("usdt")
|
|
|
|
account, err = req.Do(ctx)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NotNil(t, account)
|
|
|
|
t.Logf("account: %+v", account)
|
|
|
|
}
|
2022-04-20 05:35:17 +00:00
|
|
|
|
|
|
|
func TestAccountService_GetVipLevelRequest(t *testing.T) {
|
|
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
|
|
if !ok {
|
|
|
|
t.SkipNow()
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
|
|
client.Auth(key, secret)
|
|
|
|
|
2023-04-11 10:33:51 +00:00
|
|
|
req := client.NewGetVipLevelRequest()
|
2022-04-20 05:35:17 +00:00
|
|
|
vipLevel, err := req.Do(ctx)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NotNil(t, vipLevel)
|
|
|
|
t.Logf("vipLevel: %+v", vipLevel)
|
|
|
|
}
|
2022-04-20 05:47:12 +00:00
|
|
|
|
|
|
|
func TestAccountService_GetWithdrawHistoryRequest(t *testing.T) {
|
|
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
|
|
if !ok {
|
|
|
|
t.SkipNow()
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
|
|
client.Auth(key, secret)
|
|
|
|
|
2023-04-11 10:36:10 +00:00
|
|
|
req := client.NewGetWithdrawalHistoryRequest()
|
2022-04-20 05:47:12 +00:00
|
|
|
req.Currency("usdt")
|
|
|
|
withdraws, err := req.Do(ctx)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NotNil(t, withdraws)
|
|
|
|
assert.NotEmpty(t, withdraws)
|
|
|
|
t.Logf("withdraws: %+v", withdraws)
|
|
|
|
}
|
2022-04-20 06:01:18 +00:00
|
|
|
|
|
|
|
func TestAccountService_NewGetDepositHistoryRequest(t *testing.T) {
|
|
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
|
|
if !ok {
|
|
|
|
t.SkipNow()
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
|
|
client.Auth(key, secret)
|
|
|
|
|
2023-04-11 10:36:10 +00:00
|
|
|
req := client.NewGetDepositHistoryRequest()
|
2022-04-20 06:01:18 +00:00
|
|
|
req.Currency("usdt")
|
|
|
|
deposits, err := req.Do(ctx)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NotNil(t, deposits)
|
|
|
|
assert.NotEmpty(t, deposits)
|
|
|
|
t.Logf("deposits: %+v", deposits)
|
|
|
|
}
|