本文整理汇总了Python中pulp.plugins.model.Unit.metadata方法的典型用法代码示例。如果您正苦于以下问题:Python Unit.metadata方法的具体用法?Python Unit.metadata怎么用?Python Unit.metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.plugins.model.Unit
的用法示例。
在下文中一共展示了Unit.metadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_resolve_deps
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import metadata [as 别名]
def test_resolve_deps(self):
repo = mock.Mock(spec=Repository)
repo.working_dir = "/tmp/test_resolve_deps"
repo.id = "test_resolve_deps"
unit_key_a = {'id' : '','name' :'pulp-server', 'version' :'0.0.309', 'release' : '1.fc17', 'epoch':'0', 'arch' : 'noarch', 'checksumtype' : 'sha256',
'checksum': 'ee5afa0aaf8bd2130b7f4a9b35f4178336c72e95358dd33bda8acaa5f28ea6e9', 'type_id' : 'rpm'}
unit_key_a_obj = Unit(RPM_TYPE_ID, unit_key_a, {}, '')
unit_key_a_obj.metadata = constants.PULP_SERVER_RPM_METADATA
unit_key_b = {'id' : '', 'name' :'pulp-rpm-server', 'version' :'0.0.309', 'release' :'1.fc17', 'epoch':'0','arch' : 'noarch', 'checksumtype' :'sha256',
'checksum': '1e6c3a3bae26423fe49d26930b986e5f5ee25523c13f875dfcd4bf80f770bf56', 'type_id' : 'rpm', }
unit_key_b_obj = Unit(RPM_TYPE_ID, unit_key_b, {}, '')
unit_key_b_obj.metadata = constants.PULP_RPM_SERVER_RPM_METADATA
existing_units = []
for unit in [unit_key_a_obj, unit_key_b_obj]:
existing_units.append(unit)
conduit = importer_mocks.get_dependency_conduit(type_id=RPM_TYPE_ID, existing_units=existing_units, pkg_dir=self.pkg_dir)
config = importer_mocks.get_basic_config()
importer = YumImporter()
units = [Unit(RPM_TYPE_ID, unit_key_b, {}, '')]
result = importer.resolve_dependencies(repo, units, conduit, config)
self.assertEqual(len(list(itertools.chain(*result['resolved'].values()))), 1)
self.assertEqual(len(list(itertools.chain(*result['unresolved'].values()))), 0)
示例2: existing_units
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import metadata [as 别名]
def existing_units(self):
units = []
# for unit in [self.UNIT_KEY_A, self.UNIT_KEY_B]:
# unit = Unit(TYPE_ID_RPM, unit, {}, '')
# units.append(unit)
unit = Unit(TYPE_ID_RPM, self.UNIT_KEY_A, {}, '')
unit.metadata = constants.PULP_SERVER_RPM_METADATA
units.append(unit)
unit = Unit(TYPE_ID_RPM, self.UNIT_KEY_B, {}, '')
unit.metadata = constants.PULP_RPM_SERVER_RPM_METADATA
units.append(unit)
return units