#NEWLINE# @ mock . patch ( 'nova.objects.ServiceList.get_by_binary' ) #NEWLINE# @ mock . patch ( 'nova.objects.ComputeNodeList.get_all' ) #NEWLINE# def test_get_all_host_states_after_delete_one( self , mock_get_all , mock_get_by_binary ) : #NEWLINE# #INDENT# getter = ( lambda n : ( n . hypervisor_hostname if ( 'hypervisor_hostname' in n ) else None ) ) #NEWLINE# running_nodes = [ n for n in ironic_fakes . COMPUTE_NODES if ( getter ( n ) != 'node4uuid' ) ] #NEWLINE# mock_get_all . side_effect = [ ironic_fakes . COMPUTE_NODES , running_nodes ] #NEWLINE# mock_get_by_binary . side_effect = [ ironic_fakes . SERVICES , ironic_fakes . SERVICES ] #NEWLINE# context = 'fake_context' #NEWLINE# self . host_manager . get_all_host_states ( context ) #NEWLINE# host_states_map = self . host_manager . host_state_map #NEWLINE# self . assertEqual ( 4 , len ( host_states_map ) ) #NEWLINE# self . host_manager . get_all_host_states ( context ) #NEWLINE# host_states_map = self . host_manager . host_state_map #NEWLINE# self . assertEqual ( 3 , len ( host_states_map ) )