mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-17 07:26:48 +00:00
* Various bug fixes * Deadlink, cleanup plus bug fixes * Various Kraken fixes * Add convert func for decimal unix timestamps * Convert all test times to UTC * Kraken: Make assets a pointer to prevent excessive copying * Docker slash fix * Address nits plus bump ITBit last checked pairs timestamp * Set pairs to enabled pairs when getting active orders * Use asset translator for UpdateAccountInfo and more checks for the exchange template tool * Address MadCozBadd's nits * Make exchange var 2 chars * Make program more user friendly * Project wide comment checks and exchName check * Fix Huobi indexing bug and use correct pair formatting * Address nits + readme change
62 lines
1.3 KiB
Cheetah
62 lines
1.3 KiB
Cheetah
{{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()
|
|
}
|
|
|
|
// Implement tests for API endpoints below
|
|
{{end}}
|