本文整理汇总了Python中pulp.plugins.util.publish_step.UnitPublishStep._get_total方法的典型用法代码示例。如果您正苦于以下问题:Python UnitPublishStep._get_total方法的具体用法?Python UnitPublishStep._get_total怎么用?Python UnitPublishStep._get_total使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.plugins.util.publish_step.UnitPublishStep
的用法示例。
在下文中一共展示了UnitPublishStep._get_total方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_total_ignore_filter
# 需要导入模块: from pulp.plugins.util.publish_step import UnitPublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import _get_total [as 别名]
def test_get_total_ignore_filter(self):
step = UnitPublishStep("foo", ['bar', 'baz'])
step.association_filters = {'foo': 'bar'}
step.parent = Mock()
step.parent.repo.content_unit_counts.get.return_value = 1
total = step._get_total(ignore_filter=True)
self.assertEquals(2, total)
示例2: test_get_with_association_filter
# 需要导入模块: from pulp.plugins.util.publish_step import UnitPublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import _get_total [as 别名]
def test_get_with_association_filter(self, mock_manager_factory):
step = UnitPublishStep("foo", ['bar', 'baz'])
step.association_filters = {'foo': 'bar'}
find_by_criteria = mock_manager_factory.repo_unit_association_query_manager.return_value.\
find_by_criteria
find_by_criteria.return_value.count.return_value = 5
total = step._get_total()
criteria_object = find_by_criteria.call_args[0][0]
compare_dict(criteria_object.filters, {'foo': 'bar',
'unit_type_id': {'$in': ['bar', 'baz']}})
self.assertEquals(5, total)
示例3: test_get_total_for_none
# 需要导入模块: from pulp.plugins.util.publish_step import UnitPublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import _get_total [as 别名]
def test_get_total_for_none(self):
step = UnitPublishStep("foo", ['bar', 'baz'])
step.parent = Mock()
step.parent.repo.content_unit_counts.get.return_value = 0
total = step._get_total()
self.assertEquals(0, total)
示例4: test_get_with_association_filter
# 需要导入模块: from pulp.plugins.util.publish_step import UnitPublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import _get_total [as 别名]
def test_get_with_association_filter(self):
step = UnitPublishStep("foo", ['bar', 'baz'])
step.association_filters = {'foo': 'bar'}
total = step._get_total()
self.assertEquals(1, total)