def setup(self, mock_exists): mock_exists.return_value = True provider = mock.Mock() provider.get_device = mock.Mock(return_value='/dev/foo') self.btrfs = FileSystemBtrfs(provider, 'root_dir') self.btrfs.setup_mountpoint = mock.Mock( return_value='some-mount-point')
def __new__(self, name, device_provider, root_dir=None, custom_args=None): if name == 'ext2': return FileSystemExt2(device_provider, root_dir, custom_args) elif name == 'ext3': return FileSystemExt3(device_provider, root_dir, custom_args) elif name == 'ext4': return FileSystemExt4(device_provider, root_dir, custom_args) elif name == 'btrfs': return FileSystemBtrfs(device_provider, root_dir, custom_args) elif name == 'xfs': return FileSystemXfs(device_provider, root_dir, custom_args) elif name == 'fat16': return FileSystemFat16(device_provider, root_dir, custom_args) elif name == 'fat32': return FileSystemFat32(device_provider, root_dir, custom_args) elif name == 'squashfs': return FileSystemSquashFs(device_provider, root_dir, custom_args) elif name == 'clicfs': return FileSystemClicFs(device_provider, root_dir, custom_args) elif name == 'swap': return FileSystemSwap(device_provider, root_dir, custom_args) else: raise KiwiFileSystemSetupError( 'Support for %s filesystem not implemented' % name)