#NEWLINE# def test_get_vdi_for_vm_safely( self , vm_get_vbd_refs , vbd_get_rec , vdi_get_rec ) : #NEWLINE# #INDENT# session = 'session' #NEWLINE# vm_get_vbd_refs . return_value = [ 'a' , 'b' ] #NEWLINE# vbd_get_rec . return_value = { #NEWLINE# #INDENT# 'userdevice' : '0' , #NEWLINE# 'VDI' : 'vdi_ref' , #NEWLINE# #UNINDENT# } #NEWLINE# vdi_get_rec . return_value = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# result = vm_utils . get_vdi_for_vm_safely ( session , 'vm_ref' ) #NEWLINE# self . assertEqual ( ( 'vdi_ref' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) , result ) #NEWLINE# vm_get_vbd_refs . assert_called_once_with ( self , 'vm_ref' ) #NEWLINE# vbd_get_rec . assert_called_once_with ( session , 'a' ) #NEWLINE# vdi_get_rec . assert_called_once_with ( session , 'vdi_ref' )