| 1 |
from unittest.mock import patch |
| 2 |
from pytest import raises |
| 3 |
|
| 4 |
from kiwi.system.root_import import RootImport |
| 5 |
|
| 6 |
from kiwi.exceptions import KiwiRootImportError |
| 7 |
|
| 8 |
|
| 9 |
class TestRootImport: |
| 10 |
@patch('kiwi.system.root_import.oci.RootImportOCI') |
| 11 |
def test_docker_import(self, mock_docker_import): |
| 12 |
RootImport.new('root_dir', 'file:///image.tar.xz', 'docker') |
| 13 |
mock_docker_import.assert_called_once_with( |
| 14 |
'root_dir', 'file:///image.tar.xz', |
| 15 |
{'archive_transport': 'docker-archive'} |
| 16 |
) |
| 17 |
|
| 18 |
@patch('kiwi.system.root_import.oci.RootImportOCI') |
| 19 |
def test_oci_import(self, mock_oci_import): |
| 20 |
RootImport.new('root_dir', 'file:///image.tar.xz', 'oci') |
| 21 |
mock_oci_import.assert_called_once_with( |
| 22 |
'root_dir', 'file:///image.tar.xz', |
| 23 |
{'archive_transport': 'oci-archive'} |
| 24 |
) |
| 25 |
|
| 26 |
def test_not_implemented_import(self): |
| 27 |
with raises(KiwiRootImportError): |
| 28 |
RootImport.new('root_dir', 'file:///image.tar.xz', 'foo') |