mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Config overwrite bugfix (#363)
* Fix bug where on parsing an alternate new config it will overwrite main config.json in gct dir * Stop movement of config.json file from root dir when a new config is parsed in * Stop overiding config.json at gct dir with new config.json from root directory * RM LN :D * Fix bug where promptforconfig in config_encryption.go overwrites default config Ensure periphery command packages do not interact or save over configuration Ensure tests to not save over or change current testdata/config
This commit is contained in:
committed by
Adrian Gallagher
parent
6bdbe236c0
commit
e2d57540a6
@@ -41,7 +41,10 @@ type group struct {
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
cfg := config.GetConfig()
|
||||
cfg.LoadConfig(config.ConfigTestFile)
|
||||
err := cfg.LoadConfig("../../testdata/configtest.json", true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
commsCfg := cfg.GetCommunicationsConfig()
|
||||
s.Setup(&commsCfg)
|
||||
@@ -51,7 +54,7 @@ func TestSetup(t *testing.T) {
|
||||
func TestConnect(t *testing.T) {
|
||||
err := s.Connect()
|
||||
if err == nil {
|
||||
t.Error("test failed - slack Connect() error")
|
||||
t.Error("test failed - slack Connect() error cannot be nil")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +62,7 @@ func TestPushEvent(t *testing.T) {
|
||||
t.Parallel()
|
||||
err := s.PushEvent(base.Event{})
|
||||
if err == nil {
|
||||
t.Error("test failed - slack PushEvent() error")
|
||||
t.Error("test failed - slack PushEvent() error cannot be nil")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,10 @@ var s SMSGlobal
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
cfg := config.GetConfig()
|
||||
cfg.LoadConfig("../../testdata/configtest.json")
|
||||
err := cfg.LoadConfig("../../testdata/configtest.json", true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
commsCfg := cfg.GetCommunicationsConfig()
|
||||
s.Setup(&commsCfg)
|
||||
}
|
||||
@@ -19,14 +22,14 @@ func TestSetup(t *testing.T) {
|
||||
func TestConnect(t *testing.T) {
|
||||
err := s.Connect()
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal Connect() error")
|
||||
t.Error("test failed - SMSGlobal Connect() error", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPushEvent(t *testing.T) {
|
||||
err := s.PushEvent(base.Event{})
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal PushEvent() error")
|
||||
t.Error("test failed - SMSGlobal PushEvent() error", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,10 @@ var s SMTPservice
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
cfg := config.GetConfig()
|
||||
cfg.LoadConfig("../../testdata/configtest.json")
|
||||
err := cfg.LoadConfig("../../testdata/configtest.json", true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
commsCfg := cfg.GetCommunicationsConfig()
|
||||
s.Setup(&commsCfg)
|
||||
}
|
||||
@@ -26,17 +29,17 @@ func TestConnect(t *testing.T) {
|
||||
func TestPushEvent(t *testing.T) {
|
||||
err := s.PushEvent(base.Event{})
|
||||
if err == nil {
|
||||
t.Error("test failed - smtpservice PushEvent() error", err)
|
||||
t.Error("test failed - smtpservice PushEvent() error cannot be nil")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSend(t *testing.T) {
|
||||
err := s.Send("", "")
|
||||
if err == nil {
|
||||
t.Error("test failed - smtpservice Send() error", err)
|
||||
t.Error("test failed - smtpservice Send() error cannot be nil")
|
||||
}
|
||||
err = s.Send("subject", "alertmessage")
|
||||
if err == nil {
|
||||
t.Error("test failed - smtpservice Send() error", err)
|
||||
t.Error("test failed - smtpservice Send() error cannot be nil")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,18 @@ var T Telegram
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
cfg := config.GetConfig()
|
||||
cfg.LoadConfig("../../testdata/configtest.json")
|
||||
err := cfg.LoadConfig("../../testdata/configtest.json", true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
commsCfg := cfg.GetCommunicationsConfig()
|
||||
T.Setup(&commsCfg)
|
||||
if T.Name != "Telegram" || T.Enabled ||
|
||||
T.Token != "testest" || T.Verbose {
|
||||
if T.Name != "Telegram" || T.Enabled || T.Token != "testest" || T.Verbose {
|
||||
t.Error("test failed - telegram Setup() error, unexpected setup values",
|
||||
T.Name, T.Enabled, T.Token, T.Verbose)
|
||||
T.Name,
|
||||
T.Enabled,
|
||||
T.Token,
|
||||
T.Verbose)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user