#NEWLINE# def _test_add_driver_fields( self , mock_update = None , mock_call = None ) : #NEWLINE# #INDENT# node = ironic_utils . get_test_node ( driver = 'fake' ) #NEWLINE# instance = fake_instance . fake_instance_obj ( self . ctx , node = node . uuid ) #NEWLINE# image_meta = ironic_utils . get_test_image_meta ( ) #NEWLINE# flavor = ironic_utils . get_test_flavor ( ) #NEWLINE# self . driver . _add_driver_fields ( node , instance , image_meta , flavor ) #NEWLINE# expected_patch = [ { #NEWLINE# #INDENT# 'path' : '/instance_info/image_source' , #NEWLINE# 'op' : 'add' , #NEWLINE# 'value' : image_meta . id , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'path' : '/instance_info/root_gb' , #NEWLINE# 'op' : 'add' , #NEWLINE# 'value' : str ( instance . root_gb ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'path' : '/instance_info/swap_mb' , #NEWLINE# 'op' : 'add' , #NEWLINE# 'value' : str ( flavor [ 'swap' ] ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'path' : '/instance_info/display_name' , #NEWLINE# 'value' : instance . display_name , #NEWLINE# 'op' : 'add' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'path' : '/instance_info/vcpus' , #NEWLINE# 'op' : 'add' , #NEWLINE# 'value' : str ( instance . vcpus ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'path' : '/instance_info/memory_mb' , #NEWLINE# 'op' : 'add' , #NEWLINE# 'value' : str ( instance . memory_mb ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'path' : '/instance_info/local_gb' , #NEWLINE# 'op' : 'add' , #NEWLINE# 'value' : str ( node . properties . get ( 'local_gb' , 0 ) ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'path' : '/instance_uuid' , #NEWLINE# 'op' : 'add' , #NEWLINE# 'value' : instance . uuid , #NEWLINE# #UNINDENT# } ] #NEWLINE# if ( mock_call is not None ) : #NEWLINE# #INDENT# mock_call . assert_called_once_with ( 'node.update' , node . uuid , expected_patch , retry_on_conflict = False ) #NEWLINE# #UNINDENT# if ( mock_update is not None ) : #NEWLINE# #INDENT# mock_update . assert_called_once_with ( node . uuid , expected_patch )