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:
Ryan O'Hara-Reid
2019-09-27 16:03:41 +10:00
committed by Adrian Gallagher
parent 6bdbe236c0
commit e2d57540a6
55 changed files with 408 additions and 173 deletions

View File

@@ -110,7 +110,7 @@ func TestSetClientProxyAddress(t *testing.T) {
func TestSetAutoPairDefaults(t *testing.T) {
cfg := config.GetConfig()
err := cfg.LoadConfig(config.ConfigTestFile)
err := cfg.LoadConfig(config.ConfigTestFile, true)
if err != nil {
t.Fatalf("Test failed. TestSetAutoPairDefaults failed to load config file. Error: %s", err)
}
@@ -163,7 +163,7 @@ func TestGetLastPairsUpdateTime(t *testing.T) {
func TestSetAssetTypes(t *testing.T) {
cfg := config.GetConfig()
err := cfg.LoadConfig(config.ConfigTestFile)
err := cfg.LoadConfig(config.ConfigTestFile, true)
if err != nil {
t.Fatalf("Test failed. TestSetAssetTypes failed to load config file. Error: %s", err)
}
@@ -222,7 +222,7 @@ func TestSetCurrencyPairFormat(t *testing.T) {
t.Skip()
// TO-DO
cfg := config.GetConfig()
err := cfg.LoadConfig(config.ConfigTestFile)
err := cfg.LoadConfig(config.ConfigTestFile, true)
if err != nil {
t.Fatalf("Test failed. TestSetCurrencyPairFormat failed to load config file. Error: %s", err)
}
@@ -578,7 +578,7 @@ func TestSetPairs(t *testing.T) {
t.Skip()
// TO-DO
cfg := config.GetConfig()
err := cfg.LoadConfig(config.ConfigTestFile)
err := cfg.LoadConfig(config.ConfigTestFile, true)
if err != nil {
t.Fatal("Test failed. TestSetPairs failed to load config")
}
@@ -621,7 +621,7 @@ func TestSetPairs(t *testing.T) {
func TestUpdatePairs(t *testing.T) {
cfg := config.GetConfig()
err := cfg.LoadConfig(config.ConfigTestFile)
err := cfg.LoadConfig(config.ConfigTestFile, true)
if err != nil {
t.Fatal("Test failed. TestUpdatePairs failed to load config")
}