Files
gocryptotrader/exchanges/binance/binance_mock_test.go
Gareth Kirwan 68a6f5828f Binance: Subscribe/unsubscribe response handling (#1444)
* Binance: Fix subscription failures ignored

* Testing: Fix race on shared config singleton

* Config: Privatise Global config var

We should *either* use a private var *or* use an accessor, but it
doesn't make sense to mix paradigms.
Since GetConfig() is well established this instead removes the limited uses of direct public access and adds a Setter

* Zip: Fix test failure on http mocks
2024-02-02 19:27:17 +11:00

39 lines
706 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.TestInstance(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())
}