#NEWLINE# @ mock . patch . object ( sh , '_show_cluster' ) #NEWLINE# def test_do_cluster_update( self , mock_show ) : #NEWLINE# #INDENT# service = mock . Mock ( ) #NEWLINE# args = { #NEWLINE# #INDENT# 'profile' : 'test_profile' , #NEWLINE# 'name' : 'CLUSTER1' , #NEWLINE# 'metadata' : [ 'user=demo' ] , #NEWLINE# 'timeout' : 100 , #NEWLINE# #UNINDENT# } #NEWLINE# attrs = copy . deepcopy ( args ) #NEWLINE# attrs [ 'metadata' ] = { #NEWLINE# #INDENT# 'user' : 'demo' , #NEWLINE# #UNINDENT# } #NEWLINE# attrs [ 'profile_id' ] = 'test_profile' #NEWLINE# del attrs [ 'profile' ] #NEWLINE# args = self . _make_args ( args ) #NEWLINE# args . id = 'CID' #NEWLINE# cluster = mock . Mock ( ) #NEWLINE# cluster . id = 'CID' #NEWLINE# service . get_cluster . return_value = cluster #NEWLINE# service . update_cluster = mock . Mock ( ) #NEWLINE# sh . do_cluster_update ( service , args ) #NEWLINE# service . get_cluster . assert_called_once_with ( 'CID' ) #NEWLINE# service . update_cluster . assert_called_once_with ( 'CID' , ** attrs ) #NEWLINE# mock_show . assert_called_once_with ( service , 'CID' )