mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-14 11:03:53 +00:00
fix query ticker tests
This commit is contained in:
parent
54e6274ab4
commit
715363298f
|
@ -7,38 +7,26 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAllSymbols(t *testing.T) {
|
func TestExchange_QueryTickers_AllSymbols(t *testing.T) {
|
||||||
e := New("mock_key", "mock_secret")
|
e := New("mock_key", "mock_secret")
|
||||||
got, err := e.QueryTickers(context.Background())
|
got, err := e.QueryTickers(context.Background())
|
||||||
|
if assert.NoError(t, err) {
|
||||||
assert.NoError(t, err)
|
assert.True(t, len(got) > 1, "binance: attempting to get all symbol tickers, but get 1 or less")
|
||||||
|
}
|
||||||
if len(got) <= 1 {
|
|
||||||
t.Errorf("Binance Exchange: Attempting to get all symbol tickers, but get 1 or less")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
func TestExchange_QueryTickers_SomeSymbols(t *testing.T) {
|
||||||
|
|
||||||
func TestSomeSymbols(t *testing.T) {
|
|
||||||
e := New("mock_key", "mock_secret")
|
e := New("mock_key", "mock_secret")
|
||||||
got, err := e.QueryTickers(context.Background(), "BTCUSDT", "ETHUSDT")
|
got, err := e.QueryTickers(context.Background(), "BTCUSDT", "ETHUSDT")
|
||||||
|
if assert.NoError(t, err) {
|
||||||
assert.NoError(t, err)
|
assert.Len(t, got, 2, "binance: attempting to get two symbols, but number of tickers do not match")
|
||||||
|
|
||||||
if len(got) != 2 {
|
|
||||||
t.Errorf("Binance Exchange: Attempting to get two symbols, but number of tickers do not match")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSingleSymbol(t *testing.T) {
|
func TestExchange_QueryTickers_SingleSymbol(t *testing.T) {
|
||||||
e := New("mock_key", "mock_secret")
|
e := New("mock_key", "mock_secret")
|
||||||
got, err := e.QueryTickers(context.Background(), "BTCUSDT")
|
got, err := e.QueryTickers(context.Background(), "BTCUSDT")
|
||||||
|
if assert.NoError(t, err) {
|
||||||
assert.NoError(t, err)
|
assert.Len(t, got, 1, "binance: attempting to get one symbol, but number of tickers do not match")
|
||||||
|
|
||||||
if len(got) != 1 {
|
|
||||||
t.Errorf("Binance Exchange: Attempting to get one symbol, but number of tickers do not match")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user