kiwi-el8/test/unit/bootloader/install/init_test.py
Alexandre Detiste fb69627ad3
Use unittest.mock from core python everywhere
mock was an independent module that has been merged into the Python standard library.
2024-02-18 22:15:30 +01:00

20 lines
692 B
Python

from unittest.mock import (
patch, Mock
)
from pytest import raises
from kiwi.exceptions import KiwiBootLoaderInstallSetupError
from kiwi.bootloader.install import BootLoaderInstall
class TestBootLoaderInstall:
def test_bootloader_install_not_implemented(self):
with raises(KiwiBootLoaderInstallSetupError):
BootLoaderInstall.new('foo', 'root_dir', Mock())
@patch('kiwi.bootloader.install.grub2.BootLoaderInstallGrub2')
def test_bootloader_install_grub2(self, mock_grub2):
device_provider = Mock()
BootLoaderInstall.new('grub2', 'root_dir', device_provider)
mock_grub2.assert_called_once_with('root_dir', device_provider, None)