mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
exchanges: Improve TestMain usage (#1946)
* exchanges: Improve TestMain usage * exchanges: Further cleanups * exchanges/kucoin: update TestProcessOrderbook to use test context * refactor: rename SetRunning to SetRunningURL for clarity across exchanges
This commit is contained in:
@@ -9,7 +9,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/core"
|
||||
"github.com/thrasher-corp/gocryptotrader/currency"
|
||||
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
|
||||
@@ -28,29 +27,21 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
e = &EXMO{}
|
||||
e *EXMO
|
||||
testPair = currency.NewBTCUSD().Format(currency.PairFormat{Uppercase: true, Delimiter: "_"})
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
e.SetDefaults()
|
||||
cfg := config.GetConfig()
|
||||
err := cfg.LoadConfig("../../testdata/configtest.json", true)
|
||||
if err != nil {
|
||||
log.Fatal("Exmo load config error", err)
|
||||
}
|
||||
exmoConf, err := cfg.GetExchangeConfig("EXMO")
|
||||
if err != nil {
|
||||
log.Fatal("Exmo Setup() init error")
|
||||
e = new(EXMO)
|
||||
if err := testexch.Setup(e); err != nil {
|
||||
log.Fatalf("EXMO Setup error: %s", err)
|
||||
}
|
||||
|
||||
err = e.Setup(exmoConf)
|
||||
if err != nil {
|
||||
log.Fatal("Exmo setup error", err)
|
||||
if APIKey != "" && APISecret != "" {
|
||||
e.API.AuthenticatedSupport = true
|
||||
e.SetCredentials(APIKey, APISecret, "", "", "", "")
|
||||
}
|
||||
|
||||
e.API.AuthenticatedSupport = true
|
||||
e.SetCredentials(APIKey, APISecret, "", "", "", "")
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user