Refine test for the election pipeline process

test that the process is started with the events_queue kwargs
This commit is contained in:
Sylvain Bellemare 2017-04-11 17:21:25 +02:00
parent a673d9c6ef
commit 79997848cd

View File

@ -9,8 +9,9 @@ from bigchaindb.pipelines import vote, block, election, stale
@patch.object(block, 'start')
@patch.object(vote, 'start')
@patch.object(Process, 'start')
def test_processes_start(mock_process, mock_vote, mock_block, mock_election,
mock_stale):
@patch('bigchaindb.events.setup_events_queue', spec_set=True, autospec=True)
def test_processes_start(mock_setup_events_queue, mock_process, mock_vote,
mock_block, mock_election, mock_stale):
from bigchaindb import processes
processes.start()
@ -19,5 +20,5 @@ def test_processes_start(mock_process, mock_vote, mock_block, mock_election,
mock_block.assert_called_with()
mock_stale.assert_called_with()
mock_process.assert_called_with()
# the events queue is declared inside processes.start()
assert mock_election.call_count == 1
mock_election.assert_called_once_with(
events_queue=mock_setup_events_queue.return_value)