#NEWLINE# def setUp( self ) : #NEWLINE# #INDENT# super ( TestLibvirtVolume , self ) . setUp ( ) #NEWLINE# self . sleep_mock = self . patch ( 'devops.helpers.retry.sleep' ) #NEWLINE# self . open_mock = mock . mock_open ( read_data = 'image_data' ) #NEWLINE# self . patch ( 'devops.driver.libvirt.libvirt_driver.open' , self . open_mock , create = True ) #NEWLINE# self . os_mock = self . patch ( 'devops.helpers.helpers.os' ) #NEWLINE# Size = collections . namedtuple ( 'Size' , [ 'st_size' ] ) #NEWLINE# self . file_sizes = { #NEWLINE# #INDENT# '/tmp/admin.iso' : Size ( st_size = 500 ) , #NEWLINE# #UNINDENT# } #NEWLINE# self . os_mock . stat . side_effect = self . file_sizes . get #NEWLINE# self . env = Environment . create ( 'test_env' ) #NEWLINE# self . group = self . env . add_group ( group_name = 'test_group' , driver_name = 'devops.driver.libvirt' , connection_string = 'test:///default' , storage_pool_name = 'default-pool' ) #NEWLINE# self . node = self . group . add_node ( name = 'test_node' , role = 'default' , architecture = 'i686' , hypervisor = 'test' ) #NEWLINE# self . d = self . group . driver