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
215 lines
7.1 KiB
Python
215 lines
7.1 KiB
Python
from nose.tools import *
|
|
from mock import patch
|
|
|
|
import mock
|
|
|
|
from . import nose_helper
|
|
|
|
from kiwi.bootloader.template.grub2 import BootLoaderTemplateGrub2
|
|
|
|
|
|
class TestBootLoaderTemplateGrub2(object):
|
|
def setup(self):
|
|
self.grub2 = BootLoaderTemplateGrub2()
|
|
|
|
def test_get_disk_template(self):
|
|
assert self.grub2.get_disk_template().substitute(
|
|
search_params='--fs-uuid --set=root 0815',
|
|
default_boot='0',
|
|
kernel_file='boot/linux.vmx',
|
|
initrd_file='boot/initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community [ VMX ]',
|
|
bootpath='/boot'
|
|
)
|
|
|
|
def test_get_disk_template_serial_no_hybird(self):
|
|
assert self.grub2.get_disk_template(
|
|
terminal='serial',
|
|
hybrid=False
|
|
).substitute(
|
|
search_params='--fs-uuid --set=root 0815',
|
|
default_boot='0',
|
|
kernel_file='boot/linux.vmx',
|
|
initrd_file='boot/initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community [ VMX ]',
|
|
bootpath='/boot'
|
|
)
|
|
|
|
def test_get_multiboot_disk_template(self):
|
|
assert self.grub2.get_multiboot_disk_template().substitute(
|
|
search_params='--fs-uuid --set=root 0815',
|
|
default_boot='0',
|
|
kernel_file='linux.vmx',
|
|
initrd_file='initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community [ VMX ]',
|
|
bootpath='/boot',
|
|
hypervisor='xen.gz'
|
|
)
|
|
|
|
def test_get_multiboot_disk_template_serial(self):
|
|
assert self.grub2.get_multiboot_disk_template(
|
|
terminal='serial'
|
|
).substitute(
|
|
search_params='--fs-uuid --set=root 0815',
|
|
default_boot='0',
|
|
kernel_file='linux.vmx',
|
|
initrd_file='initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community [ VMX ]',
|
|
bootpath='/boot',
|
|
hypervisor='xen.gz'
|
|
)
|
|
|
|
def test_get_multiboot_install_template(self):
|
|
assert self.grub2.get_multiboot_install_template().substitute(
|
|
search_params='--fs-uuid --set=root 0815',
|
|
default_boot='0',
|
|
kernel_file='linux.vmx',
|
|
initrd_file='initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community [ VMX ]',
|
|
bootpath='/boot',
|
|
hypervisor='xen.gz'
|
|
)
|
|
|
|
def test_get_multiboot_install_template_serial(self):
|
|
assert self.grub2.get_multiboot_install_template(
|
|
terminal='serial'
|
|
).substitute(
|
|
search_params='--fs-uuid --set=root 0815',
|
|
default_boot='0',
|
|
kernel_file='linux.vmx',
|
|
initrd_file='initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community [ VMX ]',
|
|
bootpath='/boot',
|
|
hypervisor='xen.gz'
|
|
)
|
|
|
|
def test_get_install_template(self):
|
|
assert self.grub2.get_install_template().substitute(
|
|
search_params='--file --set=root /boot/0xd305fb7d',
|
|
default_boot='0',
|
|
kernel_file='boot/linux.vmx',
|
|
initrd_file='boot/initrd.vmx',
|
|
boot_options='cdinst=1 splash',
|
|
failsafe_boot_options='cdinst=1 splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community [ VMX ]',
|
|
bootpath='/boot'
|
|
)
|
|
|
|
def test_get_install_template_serial_no_hybrid(self):
|
|
assert self.grub2.get_install_template(
|
|
terminal='serial',
|
|
hybrid=False
|
|
).substitute(
|
|
search_params='--file --set=root /boot/0xd305fb7d',
|
|
default_boot='0',
|
|
kernel_file='boot/linux.vmx',
|
|
initrd_file='boot/initrd.vmx',
|
|
boot_options='cdinst=1 splash',
|
|
failsafe_boot_options='cdinst=1 splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community [ VMX ]',
|
|
bootpath='/boot'
|
|
)
|
|
|
|
def test_get_iso_template(self):
|
|
assert self.grub2.get_iso_template().substitute(
|
|
search_params='--file --set=root /boot/0xd305fb7d',
|
|
default_boot='0',
|
|
kernel_file='boot/linux.vmx',
|
|
initrd_file='boot/initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community',
|
|
bootpath='/boot'
|
|
)
|
|
|
|
def test_get_iso_template_serial_no_hybrid(self):
|
|
assert self.grub2.get_iso_template(
|
|
terminal='serial',
|
|
hybrid=False
|
|
).substitute(
|
|
search_params='--file --set=root /boot/0xd305fb7d',
|
|
default_boot='0',
|
|
kernel_file='boot/linux.vmx',
|
|
initrd_file='boot/initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community',
|
|
bootpath='/boot'
|
|
)
|
|
|
|
def test_get_multiboot_iso_template(self):
|
|
assert self.grub2.get_multiboot_iso_template().substitute(
|
|
search_params='--fs-uuid --set=root 0815',
|
|
default_boot='0',
|
|
kernel_file='linux.vmx',
|
|
initrd_file='initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community',
|
|
bootpath='/boot',
|
|
hypervisor='xen.gz'
|
|
)
|
|
|
|
def test_get_multiboot_iso_template_serial(self):
|
|
assert self.grub2.get_multiboot_iso_template(
|
|
terminal='serial'
|
|
).substitute(
|
|
search_params='--fs-uuid --set=root 0815',
|
|
default_boot='0',
|
|
kernel_file='linux.vmx',
|
|
initrd_file='initrd.vmx',
|
|
boot_options='splash',
|
|
failsafe_boot_options='splash',
|
|
gfxmode='800x600',
|
|
theme='SLE',
|
|
boot_timeout='10',
|
|
title='LimeJeOS-SLE12-Community',
|
|
bootpath='/boot',
|
|
hypervisor='xen.gz'
|
|
)
|