def add( dispatcher, thread_pool, consensus_proxy, consensus_notifier, ): handler = handlers.ConsensusRegisterHandler(consensus_proxy, consensus_notifier) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusRegisterBlockNewSyncHandler( consensus_proxy, consensus_notifier) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusSendToHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusBroadcastHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusInitializeBlockHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusSummarizeBlockHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusFinalizeBlockHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusCancelBlockHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusCheckBlocksHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusCheckBlocksNotifier(consensus_proxy, consensus_notifier) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusCommitBlockHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusIgnoreBlockHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusFailBlockHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusBlocksGetHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusChainHeadGetHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusSettingsGetHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool) handler = handlers.ConsensusStateGetHandler(consensus_proxy) dispatcher.add_handler(handler.request_type, handler, thread_pool)
def test_consensus_check_blocks_handler(self): handler = handlers.ConsensusCheckBlocksHandler(self.mock_proxy) request_class = handler.request_class request = request_class() request.block_ids.extend([b"test"]) result = handler.handle(None, request.SerializeToString()) response = result.message_out self.assertEqual(response.status, handler.response_class.OK) self.mock_proxy.check_blocks.assert_called_with(request.block_ids)