#NEWLINE# @ mock . patch ( 'os.path.exists' , return_value = True ) #NEWLINE# @ mock . patch ( 'nova.utils.execute' ) #NEWLINE# def test_get_disk_size( self , mock_execute , mock_exists ) : #NEWLINE# #INDENT# path = '/some/path' #NEWLINE# example_output = 'image: 00000001\nfile format: raw\nvirtual size: 4.4M (4592640 bytes)\ndisk size: 4.4M\n' #NEWLINE# mock_execute . return_value = ( example_output , '' ) #NEWLINE# self . assertEqual ( 4592640 , disk . get_disk_size ( '/some/path' ) ) #NEWLINE# mock_execute . assert_called_once_with ( 'env' , 'LC_ALL=C' , 'LANG=C' , 'qemu-img' , 'info' , path ) #NEWLINE# mock_exists . assert_called_once_with ( path )