mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Fix various tests after test branch merge
This commit is contained in:
@@ -35,6 +35,7 @@ func TestSetDefaults(t *testing.T) {
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
setup := ANX{}
|
||||
setup.Name = "ANX"
|
||||
anxSetupConfig := config.GetConfig()
|
||||
anxSetupConfig.LoadConfig("../../testdata/configtest.dat")
|
||||
anxConfig, err := anxSetupConfig.GetExchangeConfig("ANX")
|
||||
@@ -49,7 +50,7 @@ func TestSetup(t *testing.T) {
|
||||
if setup.AuthenticatedAPISupport != false {
|
||||
t.Error("Test Failed - ANX Setup() incorrect values set")
|
||||
}
|
||||
if len(setup.APIKey) <= 0 {
|
||||
if len(setup.APIKey) != 0 {
|
||||
t.Error("Test Failed - ANX Setup() incorrect values set")
|
||||
}
|
||||
if len(setup.APISecret) != 0 {
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency"
|
||||
)
|
||||
|
||||
// Please supply your own keys here to do better tests
|
||||
@@ -30,24 +29,21 @@ func TestSetDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
testConfig := config.ExchangeConfig{
|
||||
Enabled: true,
|
||||
AuthenticatedAPISupport: true,
|
||||
APIKey: testAPIKey,
|
||||
APISecret: testAPISecret,
|
||||
RESTPollingDelay: time.Duration(10),
|
||||
Verbose: false,
|
||||
Websocket: true,
|
||||
BaseCurrencies: currency.DefaultCurrencies,
|
||||
AvailablePairs: currency.MakecurrencyPairs(currency.DefaultCurrencies),
|
||||
EnabledPairs: currency.MakecurrencyPairs(currency.DefaultCurrencies),
|
||||
setup := Bitfinex{}
|
||||
setup.Name = "Bitfinex"
|
||||
cfg := config.GetConfig()
|
||||
cfg.LoadConfig("../../testdata/configtest.dat")
|
||||
bfxConfig, err := cfg.GetExchangeConfig("Bitfinex")
|
||||
if err != nil {
|
||||
t.Error("Test Failed - Bitfinex Setup() init error")
|
||||
}
|
||||
setup.Setup(bfxConfig)
|
||||
|
||||
b.Setup(testConfig)
|
||||
b.SetDefaults()
|
||||
b.Setup(bfxConfig)
|
||||
|
||||
if !b.Enabled || !b.AuthenticatedAPISupport || b.APIKey != testAPIKey ||
|
||||
b.APISecret != testAPISecret || b.RESTPollingDelay != time.Duration(10) ||
|
||||
b.Verbose || !b.Websocket || len(b.BaseCurrencies) < 1 ||
|
||||
if !b.Enabled || b.AuthenticatedAPISupport || b.RESTPollingDelay != time.Duration(10) ||
|
||||
b.Verbose || b.Websocket || len(b.BaseCurrencies) < 1 ||
|
||||
len(b.AvailablePairs) < 1 || len(b.EnabledPairs) < 1 {
|
||||
t.Error("Test Failed - Bitfinex Setup values not set correctly")
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package bitstamp
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
)
|
||||
@@ -39,18 +40,29 @@ func TestSetDefaults(t *testing.T) {
|
||||
func TestSetup(t *testing.T) {
|
||||
t.Parallel()
|
||||
b := Bitstamp{}
|
||||
conf := config.ExchangeConfig{
|
||||
Name: "bla",
|
||||
Enabled: true,
|
||||
AuthenticatedAPISupport: true,
|
||||
b.Name = "Bitstamp"
|
||||
cfg := config.GetConfig()
|
||||
cfg.LoadConfig("../../testdata/configtest.dat")
|
||||
bConfig, err := cfg.GetExchangeConfig("Bitstamp")
|
||||
if err != nil {
|
||||
t.Error("Test Failed - Bitstamp Setup() init error")
|
||||
}
|
||||
b.Setup(conf)
|
||||
|
||||
if b.Name != "bla" && b.Enabled != true && b.AuthenticatedAPISupport != true {
|
||||
t.Error("Test Failed - Setup() error")
|
||||
b.SetDefaults()
|
||||
b.Setup(bConfig)
|
||||
|
||||
if !b.IsEnabled() || b.AuthenticatedAPISupport || b.RESTPollingDelay != time.Duration(10) ||
|
||||
b.Verbose || b.Websocket || len(b.BaseCurrencies) < 1 ||
|
||||
len(b.AvailablePairs) < 1 || len(b.EnabledPairs) < 1 {
|
||||
t.Error("Test Failed - Bitstamp Setup values not set correctly")
|
||||
}
|
||||
|
||||
bConfig.Enabled = false
|
||||
b.Setup(bConfig)
|
||||
|
||||
if b.IsEnabled() {
|
||||
t.Error("Test failed - Bitstamp TestSetup incorrect value")
|
||||
}
|
||||
conf.Enabled = false
|
||||
b.Setup(conf)
|
||||
}
|
||||
|
||||
func TestGetFee(t *testing.T) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package bittrex
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
)
|
||||
@@ -23,20 +24,29 @@ func TestSetDefaults(t *testing.T) {
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
t.Parallel()
|
||||
exch := config.ExchangeConfig{
|
||||
Name: "Bittrex",
|
||||
APIKey: apiKey,
|
||||
}
|
||||
exch.Enabled = true
|
||||
b := Bittrex{}
|
||||
b.Setup(exch)
|
||||
if b.APIKey != apiKey {
|
||||
t.Error("Test Failed - Bittrex - Setup() error")
|
||||
b.Name = "Bittrex"
|
||||
cfg := config.GetConfig()
|
||||
cfg.LoadConfig("../../testdata/configtest.dat")
|
||||
bConfig, err := cfg.GetExchangeConfig("Bittrex")
|
||||
if err != nil {
|
||||
t.Error("Test Failed - Bittrex Setup() init error")
|
||||
}
|
||||
exch.Enabled = false
|
||||
b.Setup(exch)
|
||||
|
||||
b.SetDefaults()
|
||||
b.Setup(bConfig)
|
||||
|
||||
if !b.IsEnabled() || b.AuthenticatedAPISupport || b.RESTPollingDelay != time.Duration(10) ||
|
||||
b.Verbose || b.Websocket || len(b.BaseCurrencies) < 1 ||
|
||||
len(b.AvailablePairs) < 1 || len(b.EnabledPairs) < 1 {
|
||||
t.Error("Test Failed - Bittrex Setup values not set correctly")
|
||||
}
|
||||
|
||||
bConfig.Enabled = false
|
||||
b.Setup(bConfig)
|
||||
|
||||
if b.IsEnabled() {
|
||||
t.Error("Test Failed - Bittrex - Setup() error")
|
||||
t.Error("Test failed - Bittrex TestSetup incorrect value")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,17 +20,31 @@ func TestSetDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
conf := config.ExchangeConfig{
|
||||
Enabled: true,
|
||||
t.Parallel()
|
||||
b := BTCC{}
|
||||
b.Name = "BTCC"
|
||||
cfg := config.GetConfig()
|
||||
cfg.LoadConfig("../../testdata/configtest.dat")
|
||||
bConfig, err := cfg.GetExchangeConfig("BTCC")
|
||||
if err != nil {
|
||||
t.Error("Test Failed - BTCC Setup() init error")
|
||||
}
|
||||
b.Setup(conf)
|
||||
|
||||
conf = config.ExchangeConfig{
|
||||
Enabled: false,
|
||||
APIKey: apiKey,
|
||||
APISecret: apiSecret,
|
||||
b.SetDefaults()
|
||||
b.Setup(bConfig)
|
||||
|
||||
if !b.IsEnabled() || b.AuthenticatedAPISupport || b.RESTPollingDelay != time.Duration(10) ||
|
||||
b.Verbose || b.Websocket || len(b.BaseCurrencies) < 1 ||
|
||||
len(b.AvailablePairs) < 1 || len(b.EnabledPairs) < 1 {
|
||||
t.Error("Test Failed - BTCC Setup values not set correctly")
|
||||
}
|
||||
|
||||
bConfig.Enabled = false
|
||||
b.Setup(bConfig)
|
||||
|
||||
if b.IsEnabled() {
|
||||
t.Error("Test failed - BTCC TestSetup incorrect value")
|
||||
}
|
||||
b.Setup(conf)
|
||||
}
|
||||
|
||||
func TestGetFee(t *testing.T) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package btcmarkets
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
)
|
||||
@@ -20,16 +21,31 @@ func TestSetDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
conf := config.ExchangeConfig{}
|
||||
bm.Setup(conf)
|
||||
|
||||
conf = config.ExchangeConfig{
|
||||
APIKey: apiKey,
|
||||
APISecret: apiSecret,
|
||||
Enabled: true,
|
||||
AuthenticatedAPISupport: true,
|
||||
t.Parallel()
|
||||
b := BTCMarkets{}
|
||||
b.Name = "BTC Markets"
|
||||
cfg := config.GetConfig()
|
||||
cfg.LoadConfig("../../testdata/configtest.dat")
|
||||
bConfig, err := cfg.GetExchangeConfig("BTC Markets")
|
||||
if err != nil {
|
||||
t.Error("Test Failed - BTC Markets Setup() init error")
|
||||
}
|
||||
|
||||
b.SetDefaults()
|
||||
b.Setup(bConfig)
|
||||
|
||||
if !b.IsEnabled() || b.AuthenticatedAPISupport || b.RESTPollingDelay != time.Duration(10) ||
|
||||
b.Verbose || b.Websocket || len(b.BaseCurrencies) < 1 ||
|
||||
len(b.AvailablePairs) < 1 || len(b.EnabledPairs) < 1 {
|
||||
t.Error("Test Failed - BTC Markets Setup values not set correctly")
|
||||
}
|
||||
|
||||
bConfig.Enabled = false
|
||||
b.Setup(bConfig)
|
||||
|
||||
if b.IsEnabled() {
|
||||
t.Error("Test failed - BTC Markets TestSetup incorrect value")
|
||||
}
|
||||
bm.Setup(conf)
|
||||
}
|
||||
|
||||
func TestGetFee(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user