mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-24 07:26:47 +00:00
* Adds mock testing to ZB
* STEALS improved time validation code from the original STOLEN validation code :D
* Mini fixes from review
* happy fun comment stealing
* Moves the loop checker earlier to ensure no double appendages
* Fixes sneaky test
* Fixes the important part where mock tests work instead of live tests
* Skips authenticated endpoints for mock testing.
* lint
* Updates candle wrapper functions to respect design
* basic linting fix
* Reverts configtest.json, updates readme to be way better, adds coverage to validateCandlesRequest
* Tiniest grammatical fix
* Fixes more outdated code references
* Closing out a high
* Fixes spacing
* Replaces all instances of 4 spaces in tmpl files with a tab
* fixes spacing and tab related readme issues once and for all 🤞
* tidy
* indentation violation identification situation
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
//+build mock_test_off
|
|
|
|
// This will build if build tag mock_test_off is parsed and will do live testing
|
|
// using all tests in (exchange)_test.go
|
|
package zb
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/config"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues"
|
|
)
|
|
|
|
var mockTests = false
|
|
|
|
func TestMain(m *testing.M) {
|
|
cfg := config.GetConfig()
|
|
err := cfg.LoadConfig("../../testdata/configtest.json", true)
|
|
if err != nil {
|
|
log.Fatal("ZB load config error", err)
|
|
}
|
|
zbConfig, err := cfg.GetExchangeConfig("ZB")
|
|
if err != nil {
|
|
log.Fatal("ZB Setup() init error", err)
|
|
}
|
|
zbConfig.API.AuthenticatedSupport = true
|
|
zbConfig.API.Credentials.Key = apiKey
|
|
zbConfig.API.Credentials.Secret = apiSecret
|
|
z.SetDefaults()
|
|
z.Websocket = sharedtestvalues.NewTestWebsocket()
|
|
err = z.Setup(zbConfig)
|
|
if err != nil {
|
|
log.Fatal("ZB setup error", err)
|
|
}
|
|
log.Printf(sharedtestvalues.LiveTesting, z.Name, z.API.Endpoints.URL)
|
|
z.Websocket.DataHandler = sharedtestvalues.GetWebsocketInterfaceChannelOverride()
|
|
z.Websocket.TrafficAlert = sharedtestvalues.GetWebsocketStructChannelOverride()
|
|
os.Exit(m.Run())
|
|
}
|