kiwi-el8/test/unit/bootloader_install_zipl_test.py
Thomas Schraitle 45bc5a03a7 Refactor into subpackage to fix #23
Codecoverage are 100% and tests are green

Changes:
* Refactor archive_*.py -> archive subpackage
* Refactor partitioner_*.py -> partitioner subpackage
* Refactor package_manager_*.py -> package_manager/ subpackage
* Refactor bootloader_config*.py -> bootloader/config/ subpackage
* Refactor bootloader_template*.py -> bootloader/template/ subpackage
* Refactor bootloader_install*.py -> bootloader/install/ subpackage
* Refactor repository*.py -> repository/ subpackage
* Refactor filesystem*.py -> filesystem/ subpackage
* Refactor dist_*.py -> dist/dformat subpackage
  The name `dformat` as package name is needed to avoid any name
  conflicts with the built-in function `format`.
* Refactor volume_manager*.py -> volume_manager/ subpackage
* Refactor boot_image*.py -> boot/image/ subpackage
2016-02-27 10:31:31 +01:00

53 lines
1.5 KiB
Python

from nose.tools import *
from mock import patch
from mock import call
import mock
from . import nose_helper
from kiwi.exceptions import *
from kiwi.bootloader.install.zipl import BootLoaderInstallZipl
class TestBootLoaderInstallZipl(object):
@patch('kiwi.bootloader.install.zipl.MountManager')
def setup(self, mock_mount):
custom_args = {
'boot_device': '/dev/mapper/loop0p1'
}
boot_mount = mock.Mock()
boot_mount.device = custom_args['boot_device']
boot_mount.mountpoint = 'tmp_boot'
mock_mount.return_value = boot_mount
device_provider = mock.Mock()
device_provider.get_device = mock.Mock(
return_value='/dev/some-device'
)
self.bootloader = BootLoaderInstallZipl(
'root_dir', device_provider, custom_args
)
@raises(KiwiBootLoaderZiplInstallError)
def test_post_init_missing_boot_mount_path(self):
self.bootloader.post_init(None)
@patch('kiwi.bootloader.install.zipl.Command.run')
def test_install(self, mock_command):
self.bootloader.install()
self.bootloader.boot_mount.mount.assert_called_once_with()
mock_command.call_args_list == [
call(
['bash', '-c', 'cd tmpdir && zipl -V -c tmpdir/config -m menu']
),
call(
['umount', 'tmpdir']
)
]
def test_destructor(self):
self.bootloader.__del__()
self.bootloader.boot_mount.umount.assert_called_once_with()