#NEWLINE# def test_good_and_lost( self ) : #NEWLINE# #INDENT# self . mock_time . return_value = 0 #NEWLINE# event_stream = [ dict ( msg = dict ( operation = 'poll' , agent_id = '_lost' ) , reply = dict ( operation = 'execute' , command = 'RUN' , start_at = ( STEP * 2 ) , expected_duration = STEP ) , time = 1 ) , dict ( msg = dict ( operation = 'poll' , agent_id = 'beta' ) , reply = dict ( operation = 'execute' , command = 'RUN' , start_at = ( STEP * 2 ) , expected_duration = STEP ) , time = 2 ) , dict ( msg = dict ( operation = 'reply' , agent_id = 'beta' ) , reply = dict ( operation = 'none' ) , time = 20 ) , dict ( msg = dict ( operation = 'reply' , agent_id = quorum_pkg . HEARTBEAT_AGENT ) , reply = dict ( operation = 'none' ) , time = ( STEP * 10 ) ) ] #NEWLINE# quorum = make_quorum ( self . _message_queue_gen ( event_stream ) ) #NEWLINE# test_case = { #NEWLINE# #INDENT# '_lost' : DummyExecutor ( ) , #NEWLINE# 'beta' : DummyExecutor ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# result = quorum . execute ( test_case ) #NEWLINE# self . assertEqual ( set ( result . keys ( ) ) , set ( test_case . keys ( ) ) ) #NEWLINE# self . assertEqual ( 'lost' , result [ '_lost' ] [ 'status' ] ) #NEWLINE# self . assertEqual ( 'ok' , result [ 'beta' ] [ 'status' ] )