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