{{define "test"}} package {{.Name}} import ( "log" "os" "testing" "github.com/thrasher-corp/gocryptotrader/config" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" ) // Please supply your own keys here to do authenticated endpoint testing const ( apiKey = "" apiSecret = "" canManipulateRealOrders = false ) var {{.Variable}} {{.CapitalName}} func TestMain(m *testing.M) { {{.Variable}}.SetDefaults() cfg := config.GetConfig() err := cfg.LoadConfig("../../testdata/configtest.json", true) if err != nil { log.Fatal(err) } exchCfg, err := cfg.GetExchangeConfig("{{.CapitalName}}") if err != nil { log.Fatal(err) } exchCfg.API.AuthenticatedSupport = true {{ if .WS }} exchCfg.API.AuthenticatedWebsocketSupport = true {{ end }} exchCfg.API.Credentials.Key = apiKey exchCfg.API.Credentials.Secret = apiSecret err = {{.Variable}}.Setup(exchCfg) if err != nil { log.Fatal(err) } os.Exit(m.Run()) } // Ensures that this exchange package is compatible with IBotExchange func TestInterface(t *testing.T) { var e exchange.IBotExchange if e = new({{.CapitalName}}); e == nil { t.Fatal("unable to allocate exchange") } } func areTestAPIKeysSet() bool { return {{.Variable}}.ValidateAPICredentials({{.Variable}}.GetDefaultCredentials()) == nil } // Implement tests for API endpoints below {{end}}