mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-22 23:16:48 +00:00
* First pass at adding new logging system * NewLogger * NewLogger * WIP * silly bug fix * :D removed files * removed old logging interface * added tests * added tests * Started to add new lines to all f calls * Added subsystem log types * Logger improvements * Further performance improvements * changes to logger and sublogger creation * Renamed Logging types * removed old print statement * changes based on feedback * moved sublogger types to own file * :) * added console as output type * added get level command * added get/set log level via grpc command * added check for output being empty for migration support * first pass at log rotation * added log rotation * :D derp fixed * added tests * changes based on feedback * changed log type * comments * renamed file -> fileSettings * typo fix * changes based on feedback * gofmt ran on additional files * gofmt ran on additional files
65 lines
1.2 KiB
Go
65 lines
1.2 KiB
Go
package engine
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/thrasher-/gocryptotrader/currency"
|
|
)
|
|
|
|
const (
|
|
testBTCAddress = "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
|
|
)
|
|
|
|
func TestSeed(t *testing.T) {
|
|
var d DepositAddressStore
|
|
u := map[string]map[string]string{
|
|
"BITSTAMP": {
|
|
"BTC": testBTCAddress,
|
|
},
|
|
}
|
|
|
|
d.Seed(u)
|
|
r, err := d.GetDepositAddress("BITSTAMP", currency.BTC)
|
|
if err != nil {
|
|
t.Error("unexpected result")
|
|
}
|
|
|
|
if r != testBTCAddress {
|
|
t.Error("unexpected result")
|
|
}
|
|
}
|
|
|
|
func TestGetDepositAddress(t *testing.T) {
|
|
var d DepositAddressStore
|
|
_, err := d.GetDepositAddress("", currency.BTC)
|
|
if err != ErrDepositAddressStoreIsNil {
|
|
t.Error("non-error on non-existent exchange")
|
|
}
|
|
|
|
d.Store = map[string]map[string]string{
|
|
"BITSTAMP": {
|
|
"BTC": testBTCAddress,
|
|
},
|
|
}
|
|
|
|
_, err = d.GetDepositAddress("", currency.BTC)
|
|
if err != ErrExchangeNotFound {
|
|
t.Error("non-error on non-existent exchange")
|
|
}
|
|
|
|
var r string
|
|
r, err = d.GetDepositAddress("BiTStAmP", currency.NewCode("bTC"))
|
|
if err != nil {
|
|
t.Error("unexpected err: ", err)
|
|
}
|
|
|
|
if r != testBTCAddress {
|
|
t.Error("unexpected BTC address: ", r)
|
|
}
|
|
|
|
_, err = d.GetDepositAddress("BiTStAmP", currency.LTC)
|
|
if err != ErrDepositAddressNotFound {
|
|
t.Error("unexpected err: ", err)
|
|
}
|
|
}
|