localbitcoins fixes (#177)

* General LocalBitcoin fixes

* Added override variables to config for exchange packages to allow different API URL's
This commit is contained in:
soxipy
2018-08-27 07:19:29 +03:00
committed by Ryan O'Hara-Reid
parent ca0c22f422
commit fb4e2d1452
35 changed files with 885 additions and 355 deletions

View File

@@ -744,3 +744,46 @@ func TestUpdateCurrencies(t *testing.T) {
t.Errorf("Test Failed - Forced Exchange UpdateCurrencies() error: %s", err)
}
}
func TestAPIURL(t *testing.T) {
testURL := "https://api.something.com"
testURLSecondary := "https://api.somethingelse.com"
testURLDefault := "https://api.defaultsomething.com"
testURLSecondaryDefault := "https://api.defaultsomethingelse.com"
tester := Base{Name: "test"}
test := config.ExchangeConfig{}
err := tester.SetAPIURL(test)
if err == nil {
t.Error("test failed - setting zero value config")
}
test.APIURL = testURL
test.APIURLSecondary = testURLSecondary
tester.APIUrlDefault = testURLDefault
tester.APIUrlSecondaryDefault = testURLSecondaryDefault
err = tester.SetAPIURL(test)
if err != nil {
t.Error("test failed", err)
}
if tester.GetAPIURL() != testURL {
t.Error("test failed - incorrect return URL")
}
if tester.GetSecondaryAPIURL() != testURLSecondary {
t.Error("test failed - incorrect return URL")
}
if tester.GetAPIURLDefault() != testURLDefault {
t.Error("test failed - incorrect return URL")
}
if tester.GetAPIURLSecondaryDefault() != testURLSecondaryDefault {
t.Error("test failed - incorrect return URL")
}
}