示例#1
0
    def setup(self, mock_machine, mock_firmware):
        self.command_type = namedtuple('command_return_type', ['output'])

        mock_machine.return_value = 's390'

        self.firmware = mock.Mock()
        self.firmware.get_partition_table_type = mock.Mock(return_value='dasd')
        mock_firmware.return_value = self.firmware

        self.zipl = mock.Mock()
        self.template = mock.Mock()
        self.zipl.get_template.return_value = self.template
        kiwi.bootloader.config.zipl.BootLoaderTemplateZipl = mock.Mock(
            return_value=self.zipl)

        self.xml_state = mock.Mock()
        self.xml_state.build_type.get_initrd_system = mock.Mock(
            return_value=None)
        self.xml_state.build_type.get_firmware = mock.Mock(return_value=None)
        self.xml_state.build_type.get_boottimeout = mock.Mock(
            return_value='200')
        self.xml_state.build_type.get_target_blocksize = mock.Mock(
            return_value=None)
        self.xml_state.build_type.get_zipl_targettype = mock.Mock(
            return_value=None)
        self.xml_state.build_type.get_kernelcmdline = mock.Mock(
            return_value='cmdline')
        self.xml_state.xml_data.get_name = mock.Mock(return_value='image-name')
        self.xml_state.xml_data.get_displayname = mock.Mock(return_value=None)
        self.xml_state.build_type.get_image = mock.Mock(return_value='oem')
        self.bootloader = BootLoaderConfigZipl(self.xml_state, 'root_dir',
                                               {'targetbase': '/dev/loop0'})
示例#2
0
 def __new__(self, name, xml_state, root_dir, custom_args=None):
     if name == 'grub2':
         return BootLoaderConfigGrub2(xml_state, root_dir, custom_args)
     elif name == 'grub2_s390x_emu':
         return BootLoaderConfigZipl(xml_state, root_dir, custom_args)
     elif name == 'isolinux':
         return BootLoaderConfigIsoLinux(xml_state, root_dir, custom_args)
     else:
         raise KiwiBootLoaderConfigSetupError(
             'Support for %s bootloader config not implemented' % name)
示例#3
0
 def test_post_init_no_target_base(self, mock_machine):
     mock_machine.return_value = 's390'
     BootLoaderConfigZipl(mock.Mock(), 'root_dir')
示例#4
0
 def test_post_init_invalid_platform(self, mock_machine):
     mock_machine.return_value = 'unsupported-arch'
     BootLoaderConfigZipl(mock.Mock(), 'root_dir')
示例#5
0
 def test_post_init_no_target_base(self, mock_machine):
     mock_machine.return_value = 's390'
     with raises(KiwiBootLoaderZiplSetupError):
         BootLoaderConfigZipl(mock.Mock(), 'root_dir')
示例#6
0
 def test_post_init_invalid_platform(self, mock_machine):
     mock_machine.return_value = 'unsupported-arch'
     with raises(KiwiBootLoaderZiplPlatformError):
         BootLoaderConfigZipl(mock.Mock(), 'root_dir')