def test_process_sub_response_error(sm: SubscriptionManager): message = dict( result='error', request='subscribeToMarkets', payload=dict(action='get'), ) sm._logger.error = Mock() result = sm.process_sub_response(message) sm._logger.error.assert_called_once_with('Subscription error: %s', message) assert result is None
def test_process_sub_response_no_handler(sm: SubscriptionManager): message = dict( result='success', request='subscribeToMarkets', payload=dict(action='unknown'), ) sm._logger.error = Mock() result = sm.process_sub_response(message) sm._logger.error.assert_called_once_with( 'Handler for the subscription response not found: %s', message) assert result is None
def test_process_sub_response_get_handler(sm: SubscriptionManager): message = dict( result='success', request='subscribeToMarkets', payload=dict(action='get'), ) sm._logger.error = Mock() sm._process_get_action_response = Mock() result = sm.process_sub_response(message) sm._process_get_action_response.assert_called_once_with( Category(message['request']), message['payload']) assert result is None