#NEWLINE# @ mock . patch . object ( FAKE_IRONIC_CLIENT . node , 'list_ports' ) #NEWLINE# @ mock . patch . object ( FAKE_IRONIC_CLIENT . node , 'get' ) #NEWLINE# def test_show_ironic( self , mock_get , mock_list_ports ) : #NEWLINE# #INDENT# properties = { #NEWLINE# #INDENT# 'cpus' : 1 , #NEWLINE# 'memory_mb' : 512 , #NEWLINE# 'local_gb' : 10 , #NEWLINE# #UNINDENT# } #NEWLINE# node = ironic_utils . get_test_node ( properties = properties ) #NEWLINE# port = ironic_utils . get_test_port ( ) #NEWLINE# mock_get . return_value = node #NEWLINE# mock_list_ports . return_value = [ port ] #NEWLINE# res_dict = self . controller . show ( self . request , node . uuid ) #NEWLINE# expected_output = { #NEWLINE# #INDENT# 'node' : { #NEWLINE# #INDENT# 'memory_mb' : properties [ 'memory_mb' ] , #NEWLINE# 'instance_uuid' : None , #NEWLINE# 'host' : 'IRONIC MANAGED' , #NEWLINE# 'disk_gb' : properties [ 'local_gb' ] , #NEWLINE# 'interfaces' : [ { #NEWLINE# #INDENT# 'address' : port . address , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'task_state' : None , #NEWLINE# 'id' : node . uuid , #NEWLINE# 'cpus' : self [ 'cpus' ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( expected_output , res_dict ) #NEWLINE# mock_get . assert_called_once_with ( node . uuid ) #NEWLINE# mock_list_ports . assert_called_once_with ( node . uuid )