diff --git a/config_example.json b/config_example.json index 4a24ae1a16f..2e062a6c483 100644 --- a/config_example.json +++ b/config_example.json @@ -262,7 +262,7 @@ }, "exchanges": [ { - "name": "BTC Markets", + "name": "BTCMarkets", "enabled": true, "verbose": false, "httpTimeout": 15000000000, diff --git a/exchanges/btcmarkets/btcmarkets_test.go b/exchanges/btcmarkets/btcmarkets_test.go index 41054b871e9..bf0c7f26f57 100644 --- a/exchanges/btcmarkets/btcmarkets_test.go +++ b/exchanges/btcmarkets/btcmarkets_test.go @@ -3,7 +3,6 @@ package btcmarkets import ( "context" "errors" - "fmt" "log" "os" "testing" @@ -12,7 +11,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/thrasher-corp/gocryptotrader/common" - "github.com/thrasher-corp/gocryptotrader/config" "github.com/thrasher-corp/gocryptotrader/currency" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" "github.com/thrasher-corp/gocryptotrader/exchanges/kline" @@ -37,30 +35,19 @@ const ( ) func TestMain(m *testing.M) { - b.SetDefaults() - cfg := config.GetConfig() - err := cfg.LoadConfig("../../testdata/configtest.json", true) - if err != nil { - log.Fatal(err) - } - bConfig, err := cfg.GetExchangeConfig("BTC Markets") - if err != nil { - log.Fatal(err) - } - bConfig.API.Credentials.Key = apiKey - bConfig.API.Credentials.Secret = apiSecret - bConfig.API.AuthenticatedSupport = true - b.Websocket = sharedtestvalues.NewTestWebsocket() - err = b.Setup(bConfig) - if err != nil { + b = new(BTCMarkets) + if err := testexch.Setup(b); err != nil { log.Fatal(err) } - err = b.ValidateAPICredentials(context.Background(), asset.Spot) - if err != nil { - fmt.Println("API credentials are invalid:", err) - b.API.AuthenticatedSupport = false - b.API.AuthenticatedWebsocketSupport = false + + if apiKey != "" && apiSecret != "" { + b.API.AuthenticatedSupport = true + b.API.AuthenticatedWebsocketSupport = true + b.API.CredentialsValidator.RequiresBase64DecodeSecret = false + b.SetCredentials(apiKey, apiSecret, "", "", "", "") + b.Websocket.SetCanUseAuthenticatedEndpoints(true) } + os.Exit(m.Run()) } diff --git a/testdata/configtest.json b/testdata/configtest.json index 25b46d24358..9c634af8d8e 100644 --- a/testdata/configtest.json +++ b/testdata/configtest.json @@ -242,7 +242,7 @@ }, "exchanges": [ { - "name": "BTC Markets", + "name": "BTCMarkets", "enabled": true, "verbose": false, "httpTimeout": 15000000000,