本文整理汇总了Python中kiwi.xml_state.XMLState.get_build_type_vmconfig_entries方法的典型用法代码示例。如果您正苦于以下问题:Python XMLState.get_build_type_vmconfig_entries方法的具体用法?Python XMLState.get_build_type_vmconfig_entries怎么用?Python XMLState.get_build_type_vmconfig_entries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.xml_state.XMLState
的用法示例。
在下文中一共展示了XMLState.get_build_type_vmconfig_entries方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_build_type_vmconfig_entries_for_vmx_type
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_vmconfig_entries [as 别名]
def test_get_build_type_vmconfig_entries_for_vmx_type(self):
description = XMLDescription('../data/example_config.xml')
xml_data = description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'vmx')
assert state.get_build_type_vmconfig_entries() == [
'numvcpus = "4"', 'cpuid.coresPerSocket = "2"'
]
示例2: test_get_build_type_vmconfig_entries_no_machine_section
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_vmconfig_entries [as 别名]
def test_get_build_type_vmconfig_entries_no_machine_section(self):
description = XMLDescription('../data/example_disk_config.xml')
xml_data = description.load()
state = XMLState(xml_data)
assert state.get_build_type_vmconfig_entries() == []
示例3: TestXMLState
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_vmconfig_entries [as 别名]
#.........这里部分代码省略.........
def test_copy_repository_sections(self):
self.state.copy_repository_sections(self.boot_state, True)
repository = self.boot_state.get_repository_sections()[0]
assert repository.get_source().get_path() == 'iso:///image/CDs/dvd.iso'
def test_copy_preferences_subsections(self):
self.state.copy_preferences_subsections(
['bootsplash_theme'], self.boot_state
)
preferences = self.boot_state.get_preferences_sections()[0]
assert preferences.get_bootsplash_theme()[0] == 'openSUSE'
def test_copy_build_type_attributes(self):
self.state.copy_build_type_attributes(
['firmware'], self.boot_state
)
assert self.boot_state.build_type.get_firmware() == 'efi'
def test_copy_bootincluded_packages(self):
self.state.copy_bootincluded_packages(self.boot_state)
bootstrap_packages = self.boot_state.get_bootstrap_packages()
assert 'plymouth-branding-openSUSE' in bootstrap_packages
assert 'grub2-branding-openSUSE' in bootstrap_packages
assert 'gfxboot-branding-openSUSE' in bootstrap_packages
to_delete_packages = self.boot_state.get_to_become_deleted_packages()
assert 'gfxboot-branding-openSUSE' not in to_delete_packages
def test_copy_bootincluded_archives(self):
self.state.copy_bootincluded_archives(self.boot_state)
bootstrap_archives = self.boot_state.get_bootstrap_archives()
assert '/absolute/path/to/image.tgz' in bootstrap_archives
def test_copy_bootdelete_packages(self):
self.state.copy_bootdelete_packages(self.boot_state)
to_delete_packages = self.boot_state.get_to_become_deleted_packages()
assert 'vim' in to_delete_packages
def test_copy_bootdelete_packages_no_delete_section_in_boot_descr(self):
boot_description = XMLDescription(
'../data/isoboot/example-distribution-no-delete-section/config.xml'
)
boot_state = XMLState(
boot_description.load()
)
self.state.copy_bootdelete_packages(boot_state)
to_delete_packages = boot_state.get_to_become_deleted_packages()
assert 'vim' in to_delete_packages
def test_build_type_size(self):
result = self.state.get_build_type_size()
assert result.mbytes == 1024
assert result.additive
def test_get_volume_group_name(self):
assert self.state.get_volume_group_name() == 'mydisk'
def test_get_volume_group_name_default(self):
assert self.boot_state.get_volume_group_name() == 'systemVG'
def test_get_distribution_name_from_boot_attribute(self):
assert self.state.get_distribution_name_from_boot_attribute() == \
'distribution'
def test_get_fs_mount_option_list(self):
assert self.state.get_fs_mount_option_list() == ['async']
@raises(KiwiDistributionNameError)
@patch('kiwi.xml_parse.type_.get_boot')
def test_get_distribution_name_from_boot_attribute_no_boot(self, mock_boot):
mock_boot.return_value = None
self.state.get_distribution_name_from_boot_attribute()
@raises(KiwiDistributionNameError)
@patch('kiwi.xml_parse.type_.get_boot')
def test_get_distribution_name_from_boot_attribute_invalid_boot(
self, mock_boot
):
mock_boot.return_value = 'invalid'
self.state.get_distribution_name_from_boot_attribute()
def test_delete_repository_sections(self):
self.state.delete_repository_sections()
assert self.state.get_repository_sections() == []
def test_get_build_type_vmconfig_entries(self):
assert self.state.get_build_type_vmconfig_entries() == []
def test_get_build_type_vmconfig_entries_for_vmx_type(self):
description = XMLDescription('../data/example_config.xml')
xml_data = description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'vmx')
assert state.get_build_type_vmconfig_entries() == [
'numvcpus = "4"', 'cpuid.coresPerSocket = "2"'
]
def test_get_build_type_vmconfig_entries_no_machine_section(self):
description = XMLDescription('../data/example_disk_config.xml')
xml_data = description.load()
state = XMLState(xml_data)
assert state.get_build_type_vmconfig_entries() == []
示例4: TestXMLState
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import get_build_type_vmconfig_entries [as 别名]
#.........这里部分代码省略.........
def test_get_volume_group_name_default(self):
assert self.boot_state.get_volume_group_name() == 'systemVG'
def test_get_distribution_name_from_boot_attribute(self):
assert self.state.get_distribution_name_from_boot_attribute() == \
'distribution'
def test_get_fs_mount_option_list(self):
assert self.state.get_fs_mount_option_list() == ['async']
@raises(KiwiDistributionNameError)
@patch('kiwi.xml_parse.type_.get_boot')
def test_get_distribution_name_from_boot_attribute_no_boot(self, mock_boot):
mock_boot.return_value = None
self.state.get_distribution_name_from_boot_attribute()
@raises(KiwiDistributionNameError)
@patch('kiwi.xml_parse.type_.get_boot')
def test_get_distribution_name_from_boot_attribute_invalid_boot(
self, mock_boot
):
mock_boot.return_value = 'invalid'
self.state.get_distribution_name_from_boot_attribute()
def test_delete_repository_sections(self):
self.state.delete_repository_sections()
assert self.state.get_repository_sections() == []
def test_delete_repository_sections_used_for_build(self):
self.state.delete_repository_sections_used_for_build()
assert self.state.get_repository_sections()[0].get_imageonly()
def test_get_build_type_vmconfig_entries(self):
assert self.state.get_build_type_vmconfig_entries() == []
def test_get_build_type_vmconfig_entries_for_vmx_type(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'vmx')
assert state.get_build_type_vmconfig_entries() == [
'numvcpus = "4"', 'cpuid.coresPerSocket = "2"'
]
def test_get_build_type_vmconfig_entries_no_machine_section(self):
description = XMLDescription('../data/example_disk_config.xml')
xml_data = description.load()
state = XMLState(xml_data)
assert state.get_build_type_vmconfig_entries() == []
def test_get_build_type_docker_containerconfig_section(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'docker')
containerconfig = state.get_build_type_containerconfig_section()
assert containerconfig.get_name() == \
'container_name'
assert containerconfig.get_maintainer() == \
'tux'
assert containerconfig.get_workingdir() == \
'/root'
def test_set_container_tag(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'docker')
state.set_container_config_tag('new_tag')
config = state.get_container_config()
assert config['container_tag'] == 'new_tag'