当前位置: 首页>>代码示例>>Python>>正文


Python XMLState.get_build_type_machine_section方法代码示例

本文整理汇总了Python中kiwi.xml_state.XMLState.get_build_type_machine_section方法的典型用法代码示例。如果您正苦于以下问题:Python XMLState.get_build_type_machine_section方法的具体用法?Python XMLState.get_build_type_machine_section怎么用?Python XMLState.get_build_type_machine_section使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kiwi.xml_state.XMLState的用法示例。


在下文中一共展示了XMLState.get_build_type_machine_section方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_build_type_machine_section

# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_machine_section [as 别名]
 def test_get_build_type_machine_section(self):
     description = XMLDescription('../data/example_config.xml')
     xml_data = description.load()
     state = XMLState(xml_data, None, 'vmx')
     assert state.get_build_type_machine_section().get_guestOS() == 'suse'
开发者ID:toabctl,项目名称:kiwi,代码行数:7,代码来源:xml_state_test.py

示例2: test_get_build_type_machine_section

# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_machine_section [as 别名]
 def test_get_build_type_machine_section(self):
     xml_data = self.description.load()
     state = XMLState(xml_data, None, 'vmx')
     assert state.get_build_type_machine_section().get_guestOS() == 'suse'
开发者ID:Conan-Kudo,项目名称:kiwi,代码行数:6,代码来源:xml_state_test.py

示例3: TestXMLState

# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_machine_section [as 别名]

#.........这里部分代码省略.........
        description = XMLDescription('../data/example_lvm_invalid_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data, ['invalid_volume_a'])
        state.get_volumes()

    @raises(KiwiInvalidVolumeName)
    def test_get_volumes_invalid_mountpoint(self):
        description = XMLDescription('../data/example_lvm_invalid_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data, ['invalid_volume_b'])
        state.get_volumes()

    @raises(KiwiInvalidVolumeName)
    def test_get_volumes_invalid_name_for_shell(self):
        description = XMLDescription('../data/example_lvm_invalid_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data, ['invalid_volume_c'])
        state.get_volumes()

    @patch('kiwi.xml_state.XMLState.get_build_type_system_disk_section')
    def test_get_empty_volumes(self, mock_system_disk):
        mock_system_disk.return_value = None
        assert self.state.get_volumes() == []

    def test_get_strip_files_to_delete(self):
        assert self.state.get_strip_files_to_delete() == ['del-a', 'del-b']

    def test_get_strip_tools_to_keep(self):
        assert self.state.get_strip_tools_to_keep() == ['tool-a', 'tool-b']

    def test_get_strip_libraries_to_keep(self):
        assert self.state.get_strip_libraries_to_keep() == ['lib-a', 'lib-b']

    def test_get_build_type_machine_section(self):
        description = XMLDescription('../data/example_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data, None, 'vmx')
        assert state.get_build_type_machine_section().get_guestOS() == 'suse'

    def test_get_build_type_pxedeploy_section(self):
        description = XMLDescription('../data/example_pxe_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data, None, 'pxe')
        assert state.get_build_type_pxedeploy_section().get_server() == \
            '192.168.100.2'

    def test_get_drivers_list(self):
        assert self.state.get_drivers_list() == \
            ['crypto/*', 'drivers/acpi/*', 'bar']

    def test_get_build_type_oemconfig_section(self):
        description = XMLDescription('../data/example_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data, None, 'oem')
        assert state.get_build_type_oemconfig_section().get_oem_swap()[0] ==\
            'true'

    def test_get_users_sections(self):
        assert self.state.get_users_sections()[0].get_user()[0].get_name() == \
            'root'

    def test_get_users(self):
        assert self.state.get_users()[0].user_sections[0].get_name() == \
            'root'

    def test_copy_displayname(self):
开发者ID:toabctl,项目名称:kiwi,代码行数:70,代码来源:xml_state_test.py

示例4: TestXMLState

# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_machine_section [as 别名]

#.........这里部分代码省略.........
                'realpath',
                'mountpoint',
                'fullsize',
                'attributes'
            ]
        )
        assert state.get_volumes() == [
            volume_type(
                name='usr', size=None, realpath='usr',
                mountpoint='usr', fullsize=True,
                attributes=[]
            ),
            volume_type(
                name='LVRoot', size='freespace:30', realpath='/',
                mountpoint=None, fullsize=False,
                attributes=[]
            )
        ]

    @patch('kiwi.xml_state.XMLState.get_build_type_system_disk_section')
    def test_get_empty_volumes(self, mock_system_disk):
        mock_system_disk.return_value = None
        assert self.state.get_volumes() == []

    def test_get_strip_files_to_delete(self):
        assert self.state.get_strip_files_to_delete() == ['del-a', 'del-b']

    def test_get_strip_tools_to_keep(self):
        assert self.state.get_strip_tools_to_keep() == ['tool-a', 'tool-b']

    def test_get_strip_libraries_to_keep(self):
        assert self.state.get_strip_libraries_to_keep() == ['lib-a', 'lib-b']

    def test_get_build_type_machine_section(self):
        xml_data = self.description.load()
        state = XMLState(xml_data, None, 'vmx')
        assert state.get_build_type_machine_section().get_guestOS() == 'suse'

    def test_get_build_type_pxedeploy_section(self):
        description = XMLDescription('../data/example_pxe_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data, None, 'pxe')
        assert state.get_build_type_pxedeploy_section().get_server() == \
            '192.168.100.2'

    def test_get_drivers_list(self):
        assert self.state.get_drivers_list() == \
            ['crypto/*', 'drivers/acpi/*', 'bar']

    def test_get_build_type_oemconfig_section(self):
        xml_data = self.description.load()
        state = XMLState(xml_data, None, 'oem')
        assert state.get_build_type_oemconfig_section().get_oem_swap()[0] is \
            True

    def test_get_users_sections(self):
        assert self.state.get_users_sections()[0].get_user()[0].get_name() == \
            'root'

    def test_get_users(self):
        description = XMLDescription('../data/example_multiple_users_config.xml')
        xml_data = description.load()
        state = XMLState(xml_data)
        users = state.get_users()
        assert len(users) == 3
        assert any(u.get_name() == 'root' for u in users)
开发者ID:Conan-Kudo,项目名称:kiwi,代码行数:70,代码来源:xml_state_test.py


注:本文中的kiwi.xml_state.XMLState.get_build_type_machine_section方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。