Debian Codegraph @

test/unit/container/setup/oci_test.py

raw
1 from unittest.mock import patch
2 from unittest.mock import call
3 import unittest.mock as mock
4
5 from kiwi.container.setup.oci import ContainerSetupOCI
6
7
8 class TestContainerSetupOCI:
9 @patch('os.path.exists')
10 def setup(self, mock_exists):
11 mock_exists.return_value = True
12
13 self.container = ContainerSetupOCI(
14 'root_dir', {'container_name': 'system'}
15 )
16
17 self.container.deactivate_bootloader_setup = mock.Mock()
18 self.container.deactivate_root_filesystem_check = mock.Mock()
19 self.container.setup_root_console = mock.Mock()
20 self.container.deactivate_systemd_service = mock.Mock()
21
22 @patch('os.path.exists')
23 def setup_method(self, cls, mock_exists):
24 self.setup()
25
26 def test_setup(self):
27 self.container.setup()
28 self.container.deactivate_bootloader_setup.assert_called_once_with()
29 self.container.deactivate_root_filesystem_check.assert_called_once_with()
30 assert self.container.deactivate_systemd_service.call_args_list == [
31 call('device-mapper.service'),
32 call('kbd.service'),
33 call('swap.service'),
34 call('udev.service'),
35 call('proc-sys-fs-binfmt_misc.automount')
36 ]
37
38 def test_post_init(self):
39 self.container.custom_args['container_name'] == 'system'