testing: bybit references, bybit mock testing, pair formatting, standards improvement (#1322)

* fixes tests

* pair formats and extra fixes

* quick change before shazbert sees

* sneaky lint

* adds bybit mock testing and fixes test

* whoops

* error response instead

* classic forgetting to lint

* bybit live test no longer auto-records results

* ty thrasher- Update exchanges/bybit/bybit_wrapper.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

---------

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
Scott
2023-08-21 14:48:56 +10:00
committed by GitHub
parent 577817c46e
commit c7b3ace78c
16 changed files with 92170 additions and 120 deletions

View File

@@ -16,6 +16,7 @@ import (
// blockedCIExchanges are exchanges that are not able to be tested on CI
var blockedCIExchanges = []string{
"binance", // binance API is banned from executing within the US where github Actions is ran
"bybit", // bybit API is banned from executing within the US where github Actions is ran
}
func isCITest() bool {

View File

@@ -10,20 +10,20 @@ import (
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/currency"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
"github.com/thrasher-corp/gocryptotrader/exchanges/bybit"
"github.com/thrasher-corp/gocryptotrader/exchanges/okx"
"github.com/thrasher-corp/gocryptotrader/portfolio"
"github.com/thrasher-corp/gocryptotrader/portfolio/banking"
"github.com/thrasher-corp/gocryptotrader/portfolio/withdraw"
)
const (
exchangeName = "Bybit"
withdrawManagerTestExchangeName = "okx"
)
func withdrawManagerTestHelper(t *testing.T) (*ExchangeManager, *portfolioManager) {
t.Helper()
em := NewExchangeManager()
b := new(bybit.Bybit)
b := new(okx.Okx)
b.SetDefaults()
cfg, err := b.GetDefaultConfig(context.Background())
if err != nil {
@@ -72,9 +72,9 @@ func TestSubmitWithdrawal(t *testing.T) {
banking.AppendAccounts(bank)
req := &withdraw.Request{
Exchange: exchangeName,
Exchange: withdrawManagerTestExchangeName,
Currency: currency.AUD,
Description: exchangeName,
Description: withdrawManagerTestExchangeName,
Amount: 1.0,
Type: withdraw.Fiat,
Fiat: withdraw.FiatRequest{
@@ -112,7 +112,7 @@ func TestSubmitWithdrawal(t *testing.T) {
t.Errorf("received %v, expected %v", err, withdraw.ErrStrExchangeNotSupportedByAddress)
}
adds[0].SupportedExchanges = exchangeName
adds[0].SupportedExchanges = withdrawManagerTestExchangeName
_, err = m.SubmitWithdrawal(context.Background(), req)
if !errors.Is(err, exchange.ErrAuthenticationSupportNotEnabled) {
t.Errorf("received '%v', expected '%v'", err, exchange.ErrAuthenticationSupportNotEnabled)