本文整理汇总了Python中pulp_rpm.plugins.profilers.yum.YumProfiler._translate_erratum方法的典型用法代码示例。如果您正苦于以下问题:Python YumProfiler._translate_erratum方法的具体用法?Python YumProfiler._translate_erratum怎么用?Python YumProfiler._translate_erratum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp_rpm.plugins.profilers.yum.YumProfiler
的用法示例。
在下文中一共展示了YumProfiler._translate_erratum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__translate_erratum_returns_unit_keys
# 需要导入模块: from pulp_rpm.plugins.profilers.yum import YumProfiler [as 别名]
# 或者: from pulp_rpm.plugins.profilers.yum.YumProfiler import _translate_erratum [as 别名]
def test__translate_erratum_returns_unit_keys(self, _rpms_applicable_to_consumer):
"""
The agent handler is expecting to be given a unit key, and we had a bug[0] wherein it was
being given only 'name' in the unit key, with all of the other "EVRA" fields being written
into it. This test asserts that the first element of the return value of the
_translate_erratum() method has full unit keys.
[0] https://bugzilla.redhat.com/show_bug.cgi?id=1097434
"""
unit = mock.MagicMock()
repo_ids = ["repo_1", "repo_2"]
consumer = mock.MagicMock()
conduit = mock.MagicMock()
# Mock there being an applicable RPM
applicable_unit_key = {"name": "a_name", "epoch": "0", "version": "2.0.1", "release": "2", "arch": "x86_64"}
_rpms_applicable_to_consumer.return_value = ([applicable_unit_key], mock.MagicMock())
rpms, details = YumProfiler._translate_erratum(unit, repo_ids, consumer, conduit)
expected_rpms = [{"unit_key": applicable_unit_key, "type_id": TYPE_ID_RPM}]
self.assertEqual(rpms, expected_rpms)