mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 23:16:49 +00:00
* Test: Internal exchange coverage * Tests: Rename exchange.TestInstance to Setup This package function is either going to be imported and used as just exchange.Setup, or more likely testexch.Setup. This removes the Stutter of having internal/testing/exchange.TestInstance which is implicit given the package path
39 lines
699 B
Go
39 lines
699 B
Go
//go:build !mock_test_off
|
|
|
|
// This will build if build tag mock_test_off is not parsed and will try to mock
|
|
// all tests in _test.go
|
|
package binance
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
|
|
testexch "github.com/thrasher-corp/gocryptotrader/internal/testing/exchange"
|
|
)
|
|
|
|
var mockTests = true
|
|
|
|
func TestMain(m *testing.M) {
|
|
if useTestNet {
|
|
log.Fatal("cannot use testnet with mock tests")
|
|
}
|
|
|
|
b = new(Binance)
|
|
if err := testexch.Setup(b); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
if err := testexch.MockHTTPInstance(b); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
b.setupOrderbookManager()
|
|
if err := b.UpdateTradablePairs(context.Background(), true); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
os.Exit(m.Run())
|
|
}
|