本文整理汇总了Python中pulp_rpm.plugins.profilers.yum.YumProfiler.calculate_applicable_units方法的典型用法代码示例。如果您正苦于以下问题:Python YumProfiler.calculate_applicable_units方法的具体用法?Python YumProfiler.calculate_applicable_units怎么用?Python YumProfiler.calculate_applicable_units使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp_rpm.plugins.profilers.yum.YumProfiler
的用法示例。
在下文中一共展示了YumProfiler.calculate_applicable_units方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_unit_applicable_false
# 需要导入模块: from pulp_rpm.plugins.profilers.yum import YumProfiler [as 别名]
# 或者: from pulp_rpm.plugins.profilers.yum.YumProfiler import calculate_applicable_units [as 别名]
def test_unit_applicable_false(self):
rpm_unit_key = self.create_profile_entry("bla-bla", 0, "0.1", "2", "x86_64", "Test Vendor")
rpm_unit = Unit(TYPE_ID_RPM, rpm_unit_key, {}, None)
test_repo = profiler_mocks.get_repo("test_repo_id")
conduit = profiler_mocks.get_profiler_conduit(repo_units=[rpm_unit], repo_bindings=[test_repo])
prof = YumProfiler()
unit_profile = self.test_consumer.profiles[TYPE_ID_RPM]
bound_repo_id = "test_repo_id"
report_list = prof.calculate_applicable_units(unit_profile, bound_repo_id, None, conduit)
self.assertEqual(report_list, {TYPE_ID_RPM: [], TYPE_ID_ERRATA: []})
示例2: test_unit_applicable_true
# 需要导入模块: from pulp_rpm.plugins.profilers.yum import YumProfiler [as 别名]
# 或者: from pulp_rpm.plugins.profilers.yum.YumProfiler import calculate_applicable_units [as 别名]
def test_unit_applicable_true(self):
rpm_unit_key = self.create_profile_entry("emoticons", 0, "0.1", "2", "x86_64", "Test Vendor")
rpm_unit = Unit(TYPE_ID_RPM, rpm_unit_key, {}, None)
# Let's give it an id, so we can assert for it later
rpm_unit.id = "a_test_id"
test_repo = profiler_mocks.get_repo("test_repo_id")
conduit = profiler_mocks.get_profiler_conduit(repo_units=[rpm_unit], repo_bindings=[test_repo])
prof = YumProfiler()
unit_profile = self.test_consumer.profiles[TYPE_ID_RPM]
bound_repo_id = "test_repo_id"
report_list = prof.calculate_applicable_units(unit_profile, bound_repo_id, None, conduit)
self.assertEqual(report_list, {TYPE_ID_RPM: [rpm_unit.id], TYPE_ID_ERRATA: []})
示例3: test_unit_applicable_false
# 需要导入模块: from pulp_rpm.plugins.profilers.yum import YumProfiler [as 别名]
# 或者: from pulp_rpm.plugins.profilers.yum.YumProfiler import calculate_applicable_units [as 别名]
def test_unit_applicable_false(self):
# Errata refers to RPMs which are NOT part of our test consumer's profile
errata_obj = self.get_test_errata_object_unrelated()
errata_unit = Unit(TYPE_ID_ERRATA, {"id": errata_obj["id"]}, errata_obj, None)
test_repo = profiler_mocks.get_repo("test_repo_id")
prof = YumProfiler()
errata_rpms = prof._get_rpms_from_errata(errata_unit)
conduit = profiler_mocks.get_profiler_conduit(repo_units=[errata_unit],
repo_bindings=[test_repo],
errata_rpms=errata_rpms)
unit_profile = self.test_consumer.profiles[TYPE_ID_RPM]
bound_repo_id = "test_repo_id"
report_list = prof.calculate_applicable_units(unit_profile, bound_repo_id, None, conduit)
self.assertEqual(report_list, {TYPE_ID_ERRATA: [], TYPE_ID_RPM: []})
示例4: test_unit_applicable_updated_rpm_already_installed
# 需要导入模块: from pulp_rpm.plugins.profilers.yum import YumProfiler [as 别名]
# 或者: from pulp_rpm.plugins.profilers.yum.YumProfiler import calculate_applicable_units [as 别名]
def test_unit_applicable_updated_rpm_already_installed(self):
# Errata refers to RPMs already installed, i.e. the consumer has these exact NEVRA already
errata_obj = self.get_test_errata_object()
errata_unit = Unit(TYPE_ID_ERRATA, {"id": errata_obj["id"]}, errata_obj, None)
test_repo = profiler_mocks.get_repo("test_repo_id")
prof = YumProfiler()
errata_rpms = prof._get_rpms_from_errata(errata_unit)
conduit = profiler_mocks.get_profiler_conduit(repo_units=[errata_unit],
repo_bindings=[test_repo],
errata_rpms=errata_rpms)
unit_profile = self.test_consumer_been_updated.profiles[TYPE_ID_RPM]
bound_repo_id = "test_repo_id"
report_list = prof.calculate_applicable_units(unit_profile, bound_repo_id, None, conduit)
self.assertEqual(report_list, {TYPE_ID_RPM: [], TYPE_ID_ERRATA: []})
示例5: test_unit_applicable_same_name_diff_arch
# 需要导入模块: from pulp_rpm.plugins.profilers.yum import YumProfiler [as 别名]
# 或者: from pulp_rpm.plugins.profilers.yum.YumProfiler import calculate_applicable_units [as 别名]
def test_unit_applicable_same_name_diff_arch(self):
# Errata refers to RPMs that are x86_64, the test consumer is i386
# the rpms installed share the same name as the errata, but the client arch is different
# so this errata is marked as unapplicable
errata_obj = self.get_test_errata_object()
errata_unit = Unit(TYPE_ID_ERRATA, {"id": errata_obj["id"]}, errata_obj, None)
test_repo = profiler_mocks.get_repo("test_repo_id")
prof = YumProfiler()
errata_rpms = prof._get_rpms_from_errata(errata_unit)
conduit = profiler_mocks.get_profiler_conduit(repo_units=[errata_unit],
repo_bindings=[test_repo],
errata_rpms=errata_rpms)
unit_profile = self.test_consumer_i386.profiles[TYPE_ID_RPM]
bound_repo_id = "test_repo_id"
report_list = prof.calculate_applicable_units(unit_profile, bound_repo_id, None, conduit)
self.assertEqual(report_list, {TYPE_ID_RPM: [], TYPE_ID_ERRATA: []})
示例6: test_unit_applicable
# 需要导入模块: from pulp_rpm.plugins.profilers.yum import YumProfiler [as 别名]
# 或者: from pulp_rpm.plugins.profilers.yum.YumProfiler import calculate_applicable_units [as 别名]
def test_unit_applicable(self):
# Errata refers to RPMs which ARE part of our test consumer's profile,
# AND in the repo.
errata_obj = self.get_test_errata_object()
errata_unit = Unit(TYPE_ID_ERRATA, {"id": errata_obj["id"]}, errata_obj, None)
errata_unit.id = "an_errata"
rpm_unit_key = self.create_profile_entry("emoticons", 0, "0.1", "2", "x86_64", "Test Vendor")
rpm_unit = Unit(TYPE_ID_RPM, rpm_unit_key, {}, None)
# Let's give it an id, so we can assert for it later
rpm_unit.id = "a_test_id"
test_repo = profiler_mocks.get_repo("test_repo_id")
prof = YumProfiler()
errata_rpms = prof._get_rpms_from_errata(errata_unit)
conduit = profiler_mocks.get_profiler_conduit(
repo_units=[errata_unit, rpm_unit], repo_bindings=[test_repo], errata_rpms=errata_rpms
)
unit_profile = self.test_consumer.profiles[TYPE_ID_RPM]
bound_repo_id = "test_repo_id"
report_list = prof.calculate_applicable_units(unit_profile, bound_repo_id, None, conduit)
self.assertEqual(report_list, {TYPE_ID_RPM: ["a_test_id"], TYPE_ID_ERRATA: ["an_errata"]})