#NEWLINE# def test_get_disk_backing_file( self ) : #NEWLINE# #INDENT# with_actual_path = False #NEWLINE# def fake_execute( * args , **kwargs ) : #NEWLINE# #INDENT# if with_actual_path : #NEWLINE# #INDENT# return ( 'some: output\nbacking file: /foo/bar/baz (actual path: /a/b/c)\n...: ...\n' , '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( 'some: output\nbacking file: /foo/bar/baz\n...: ...\n' , '' ) #NEWLINE# #UNINDENT# #UNINDENT# def return_true( * args , **kwargs ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# self . stubs . Set ( utils , 'execute' , fake_execute ) #NEWLINE# self . stub_out ( 'os.path.exists' , return_true ) #NEWLINE# out = libvirt_utils . get_disk_backing_file ( '' ) #NEWLINE# self . assertEqual ( out , 'baz' ) #NEWLINE# with_actual_path = True #NEWLINE# out = libvirt_utils . get_disk_backing_file ( '' ) #NEWLINE# self . assertEqual ( out , 'c' )