mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Add addr helpers (will be split off into own package) Engine status updates (log and data dir display) Use GetPairFormat for various exchanges instead of calling the config QA fixes Implement GCTRPC exchange deposit address handling
65 lines
1.3 KiB
Go
65 lines
1.3 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": map[string]string{
|
|
"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": map[string]string{
|
|
"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)
|
|
}
|
|
}
|