mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 23:16:54 +00:00
subscriptions: Add templating support and integrate with Binance (#1568)
* Subscriptions: Add List.AssetPairs * Subscriptions: Add Template and QualifiedChannel These fields separate the concept of what the channel is from the qualified resource name * Subscriptions: Add List.SetStates() * Subscriptions: Add List.QualifiedChannels * Subscriptions: Rename testsubs.EqualLists * Binance: Switch to ExpandTemplates * Binance: Update ConfigTest format * Subscriptions: Test Coverage improvements * Subscriptions: Reenterant List.ExpandTemplates * Subscriptions: Move templates from subscriptions to exchanges * Binance: Inline subscription template and improvements
This commit is contained in:
@@ -2818,11 +2818,7 @@ func TestGetCachedOpenInterest(t *testing.T) {
|
||||
// TestSetSubscriptionsFromConfig tests the setting and loading of subscriptions from config and exchange defaults
|
||||
func TestSetSubscriptionsFromConfig(t *testing.T) {
|
||||
t.Parallel()
|
||||
b := Base{
|
||||
Config: &config.Exchange{
|
||||
Features: &config.FeaturesConfig{},
|
||||
},
|
||||
}
|
||||
b := Base{Config: &config.Exchange{Features: &config.FeaturesConfig{}}}
|
||||
subs := subscription.List{
|
||||
{Channel: subscription.CandlesChannel, Interval: kline.OneDay, Enabled: true},
|
||||
{Channel: subscription.OrderbookChannel, Enabled: false},
|
||||
@@ -2900,6 +2896,17 @@ func TestGetDefaultConfig(t *testing.T) {
|
||||
assert.Equal(t, cpy, exch.Requester)
|
||||
}
|
||||
|
||||
// TestCanUseAuthenticatedWebsocketEndpoints exercises CanUseAuthenticatedWebsocketEndpoints
|
||||
func TestCanUseAuthenticatedWebsocketEndpoints(t *testing.T) {
|
||||
t.Parallel()
|
||||
e := &FakeBase{}
|
||||
assert.False(t, e.CanUseAuthenticatedWebsocketEndpoints(), "CanUseAuthenticatedWebsocketEndpoints should return false with nil websocket")
|
||||
e.Websocket = stream.NewWebsocket()
|
||||
assert.False(t, e.CanUseAuthenticatedWebsocketEndpoints())
|
||||
e.Websocket.SetCanUseAuthenticatedEndpoints(true)
|
||||
assert.True(t, e.CanUseAuthenticatedWebsocketEndpoints())
|
||||
}
|
||||
|
||||
// FakeBase is used to override functions
|
||||
type FakeBase struct{ Base }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user