#NEWLINE# @ mock . patch . object ( FAKE_CLIENT . node , 'get' ) #NEWLINE# @ mock . patch . object ( FAKE_CLIENT . node , 'list' ) #NEWLINE# @ mock . patch . object ( ironic_driver . IronicDriver , '_node_resource' ) #NEWLINE# def test_get_available_resource_with_cache( self , mock_nr , mock_list , mock_get ) : #NEWLINE# #INDENT# node = ironic_utils . get_test_node ( ) #NEWLINE# fake_resource = 'fake-resource' #NEWLINE# mock_list . return_value = [ node ] #NEWLINE# mock_nr . return_value = fake_resource #NEWLINE# self . driver . get_available_nodes ( refresh = True ) #NEWLINE# mock_list . reset_mock ( ) #NEWLINE# result = self . driver . get_available_resource ( node . uuid ) #NEWLINE# self . assertEqual ( mock_get , result ) #NEWLINE# self . assertEqual ( 0 , mock_list . call_count ) #NEWLINE# self . assertEqual ( 0 , mock_get . call_count ) #NEWLINE# mock_nr . assert_called_once_with ( node )