def test_sub_payload(sm: SubscriptionManager): sm._filter_none = Mock(return_value='value') params = dict(action=Action.SUBSCRIBE, topics=['ETH_AURA'], events=MarketEvents.ORDERS) result = sm._sub_payload(**params) sm._filter_none.assert_called_once_with( dict(action=Action.SUBSCRIBE.value, topics=['ETH_AURA'], events=MarketEvents.ORDERS)) assert result == 'value'
def test_filter_none(sm: SubscriptionManager): assert sm._filter_none({1: 2}) == {1: 2} assert sm._filter_none({1: 2, 3: None}) == {1: 2}