1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
from unittest.mock import patch
from pytest import raises
from unittest.mock import Mock
from kiwi.filesystem import FileSystem
from kiwi.exceptions import KiwiFileSystemSetupError
class TestFileSystem:
def test_filesystem_not_implemented(self):
with raises(KiwiFileSystemSetupError):
FileSystem.new('foo', Mock(), 'root_dir')
@patch('kiwi.filesystem.ext2.FileSystemExt2')
def test_filesystem_ext2(self, mock_ext2):
provider = Mock()
FileSystem.new('ext2', provider, 'root_dir')
mock_ext2.assert_called_once_with(provider, 'root_dir', None)
@patch('kiwi.filesystem.ext3.FileSystemExt3')
def test_filesystem_ext3(self, mock_ext3):
provider = Mock()
FileSystem.new('ext3', provider, 'root_dir')
mock_ext3.assert_called_once_with(provider, 'root_dir', None)
@patch('kiwi.filesystem.ext4.FileSystemExt4')
def test_filesystem_ext4(self, mock_ext4):
provider = Mock()
FileSystem.new('ext4', provider, 'root_dir')
mock_ext4.assert_called_once_with(provider, 'root_dir', None)
@patch('kiwi.filesystem.xfs.FileSystemXfs')
def test_filesystem_xfs(self, mock_xfs):
provider = Mock()
FileSystem.new('xfs', provider, 'root_dir')
mock_xfs.assert_called_once_with(provider, 'root_dir', None)
@patch('kiwi.filesystem.btrfs.FileSystemBtrfs')
def test_filesystem_btrfs(self, mock_btrfs):
provider = Mock()
FileSystem.new('btrfs', provider, 'root_dir')
mock_btrfs.assert_called_once_with(provider, 'root_dir', None)
@patch('kiwi.filesystem.fat16.FileSystemFat16')
def test_filesystem_fat16(self, mock_fat16):
provider = Mock()
FileSystem.new('fat16', provider, 'root_dir')
mock_fat16.assert_called_once_with(provider, 'root_dir', None)
@patch('kiwi.filesystem.fat32.FileSystemFat32')
def test_filesystem_fat32(self, mock_fat32):
provider = Mock()
FileSystem.new('fat32', provider, 'root_dir')
mock_fat32.assert_called_once_with(provider, 'root_dir', None)
@patch('kiwi.filesystem.squashfs.FileSystemSquashFs')
def test_filesystem_squashfs(self, mock_squashfs):
provider = Mock()
FileSystem.new('squashfs', provider, 'root_dir')
mock_squashfs.assert_called_once_with(provider, 'root_dir', None)
@patch('kiwi.filesystem.swap.FileSystemSwap')
def test_filesystem_swap(self, mock_swap):
provider = Mock()
FileSystem.new('swap', provider)
mock_swap.assert_called_once_with(provider, None, None)
|