Bitstamp/Kraken: Enhance test coverage (#1423)

* Bitstamp: Improve GetAccountTradingFees

* Bitstamp: Improve test coverage

* Bitstamp: Improve TestWithdrawInternationalBank and TestWithdrawFiat

* Bitstamp: Fix the failing tests WIP

* Bitstamp: Fix TestWithdraw mockTest

* Bitstamp: Fix TestWithdrawFiat

* Bitstamp: Fix TestWithdrawInternationalBank

* Bitstamp: Simplify conditions in TestGetDepositAddress

* Bitstamp: Switch Ws functions Errors to assert.Error

* Bitstamp: Fix TestSubmitOrder, update other errors

* Bitstamp: Fix TestGetOrderStatus, amend error comments

* Bitstamp: Fix TestGetOrderInfo

* Bitstamp: Fix TestTransferAccountBalance

* Bitstamp: Update TestGetWithdrawalsHistory, fix linter errors

* Bitstamp: Update TestGetRecentTrades, change type Withdrawal.Requests.Date

* Bitstamp: Update TestGetDepositAddress, TestBitstamp_OHLC, TestBitstamp_GetHistoricCandles, TestBitstamp_GetHistoricCandlesExtended

* Bitstamp: Fix tests

* Bitstamp: Fix the typos and linter, add a side test to TestGetTicker

* Bitstamp: Update WithdrawFiat and WithdrawFiatFundsToInternationalBank

* Bitstamp: Fix the error description

* Bitstamp: Fixup SkipTestIfCredentialsUnset

* Bitstamp: Fixup tests

* Bitstamp: Fix panic, skip live test TestWithdraw, amend mocktest

* Bitstamp: Fixup

* Bitstamp: Fixup

* Bitstamp: Fixup
This commit is contained in:
Bea
2024-02-05 06:39:44 +07:00
committed by GitHub
parent 68a6f5828f
commit e0c6e118ed
5 changed files with 610 additions and 419 deletions

View File

@@ -30,9 +30,15 @@ func TestMain(m *testing.M) {
}
b.SkipAuthCheck = true
bitstampConfig.API.AuthenticatedSupport = true
bitstampConfig.API.Credentials.Key = apiKey
bitstampConfig.API.Credentials.Secret = apiSecret
bitstampConfig.API.Credentials.ClientID = customerID
if apiKey != "" {
bitstampConfig.API.Credentials.Key = apiKey
}
if apiSecret != "" {
bitstampConfig.API.Credentials.Secret = apiSecret
}
if customerID != "" {
bitstampConfig.API.Credentials.ClientID = customerID
}
b.SetDefaults()
b.Websocket = sharedtestvalues.NewTestWebsocket()
err = b.Setup(bitstampConfig)

File diff suppressed because one or more lines are too long

View File

@@ -24,15 +24,16 @@ var errWSPairParsingError = errors.New("unable to parse currency pair from wsRes
// Ticker holds ticker information
type Ticker struct {
Last float64 `json:"last,string"`
High float64 `json:"high,string"`
Low float64 `json:"low,string"`
Vwap float64 `json:"vwap,string"`
Volume float64 `json:"volume,string"`
Bid float64 `json:"bid,string"`
Ask float64 `json:"ask,string"`
Timestamp int64 `json:"timestamp,string"`
Open float64 `json:"open,string"`
Last float64 `json:"last,string"`
High float64 `json:"high,string"`
Low float64 `json:"low,string"`
Vwap float64 `json:"vwap,string"`
Volume float64 `json:"volume,string"`
Bid float64 `json:"bid,string"`
Ask float64 `json:"ask,string"`
Timestamp int64 `json:"timestamp,string"`
Open float64 `json:"open,string"`
Side orderSide `json:"side,string"`
}
// OrderbookBase holds singular price information
@@ -166,12 +167,12 @@ type WithdrawalRequests struct {
// CryptoWithdrawalResponse response from a crypto withdrawal request
type CryptoWithdrawalResponse struct {
ID int64 `json:"id"`
ID int64 `json:"withdrawal_id"`
}
// FIATWithdrawalResponse response from a fiat withdrawal request
type FIATWithdrawalResponse struct {
ID int64 `json:"id"`
ID int64 `json:"withdrawal_id"`
}
// UnconfirmedBTCTransactions holds address information about unconfirmed

View File

@@ -2200,9 +2200,7 @@ func TestGetFuturesContractDetails(t *testing.T) {
}
_, err = k.GetFuturesContractDetails(context.Background(), asset.Futures)
if !errors.Is(err, nil) {
t.Error(err)
}
assert.NoError(t, err, "GetFuturesContractDetails should not error")
}
func TestGetLatestFundingRates(t *testing.T) {