kiwi-el8/test/unit/bootloader_config_test.py
Marcus Schäfer cfd8ba7732
Fixed setup of bootloader files
The BootLoaderConfig class interface writes several files
e.g etc/sysconfig/bootloader, boot/grub2/grub.cfg and more.
Depending on the image type some of those files belongs
into the root directory and some belongs into the boot
directory. For standard images both locations points to
the same master root entry point. However for special
types like live systems the root tree and the boot tree
are different targets. For example live root filesystems
are a squashfs compressed image file whereas the plain
booting information lives outside. Because of that this
patch introduces a refactoring of the BootLoaderConfig
class to allow to distinguish between root_dir and
boot_dir paths. In addition the live image builder makes
use of the new concept and thus Fixes #1112
2019-07-15 10:35:54 +02:00

35 lines
1.3 KiB
Python

from mock import patch
import mock
from .test_helper import raises
from kiwi.exceptions import KiwiBootLoaderConfigSetupError
from kiwi.bootloader.config import BootLoaderConfig
class TestBootLoaderConfig(object):
@raises(KiwiBootLoaderConfigSetupError)
def test_bootloader_config_not_implemented(self):
BootLoaderConfig('foo', mock.Mock(), 'root_dir')
@patch('kiwi.bootloader.config.BootLoaderConfigGrub2')
def test_bootloader_config_grub2(self, mock_grub2):
xml_state = mock.Mock()
BootLoaderConfig('grub2', xml_state, 'root_dir')
mock_grub2.assert_called_once_with(xml_state, 'root_dir', None, None)
@patch('kiwi.bootloader.config.BootLoaderConfigIsoLinux')
def test_bootloader_config_isolinux(self, mock_isolinux):
xml_state = mock.Mock()
BootLoaderConfig('isolinux', xml_state, 'root_dir', 'boot_dir')
mock_isolinux.assert_called_once_with(
xml_state, 'root_dir', 'boot_dir', None
)
@patch('kiwi.bootloader.config.BootLoaderConfigZipl')
def test_bootloader_config_zipl(self, mock_zipl):
xml_state = mock.Mock()
BootLoaderConfig('grub2_s390x_emu', xml_state, 'root_dir')
mock_zipl.assert_called_once_with(xml_state, 'root_dir', None, None)