本文整理匯總了Python中pulp.plugins.util.publish_step.UnitPublishStep.parent方法的典型用法代碼示例。如果您正苦於以下問題:Python UnitPublishStep.parent方法的具體用法?Python UnitPublishStep.parent怎麽用?Python UnitPublishStep.parent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pulp.plugins.util.publish_step.UnitPublishStep
的用法示例。
在下文中一共展示了UnitPublishStep.parent方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_total_ignore_filter
# 需要導入模塊: from pulp.plugins.util.publish_step import UnitPublishStep [as 別名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import parent [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_process_step_no_units
# 需要導入模塊: from pulp.plugins.util.publish_step import UnitPublishStep [as 別名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import parent [as 別名]
def test_process_step_no_units(self, mock_get_units):
self.publisher.repo.content_unit_counts = {'FOO_TYPE': 0}
mock_method = Mock()
mock_get_units.return_value = []
step = UnitPublishStep('foo_step', 'FOO_TYPE')
step.parent = self.publisher
step.process_unit = mock_method
step.process()
self.assertEquals(step.state, reporting_constants.STATE_COMPLETE)
self.assertFalse(mock_method.called)
示例3: test_process_step_single_unit_exception
# 需要導入模塊: from pulp.plugins.util.publish_step import UnitPublishStep [as 別名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import parent [as 別名]
def test_process_step_single_unit_exception(self, mock_get_units):
self.publisher.repo.content_unit_counts = {'FOO_TYPE': 1}
mock_method = Mock(side_effect=Exception())
mock_get_units.return_value = ['mock_unit']
step = UnitPublishStep('foo_step', 'FOO_TYPE')
step.parent = self.publisher
step.process_unit = mock_method
self.assertRaises(Exception, step.process)
self.assertEquals(step.state, reporting_constants.STATE_FAILED)
self.assertEquals(step.progress_successes, 0)
self.assertEquals(step.progress_failures, 1)
self.assertEquals(step.total_units, 1)
mock_method.assert_called_once_with('mock_unit')
示例4: test_process_step_single_unit
# 需要導入模塊: from pulp.plugins.util.publish_step import UnitPublishStep [as 別名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import parent [as 別名]
def test_process_step_single_unit(self, mock_get_units):
self.publisher.repo.content_unit_counts = {'FOO_TYPE': 1}
mock_method = Mock()
mock_get_units.return_value = ['mock_unit']
step = UnitPublishStep('foo_step', 'FOO_TYPE')
step.parent = self.publisher
step.process_unit = mock_method
step.process()
self.assertEquals(step.state, reporting_constants.STATE_COMPLETE)
self.assertEquals(step.progress_successes, 1)
self.assertEquals(step.progress_failures, 0)
self.assertEquals(step.total_units, 1)
mock_method.assert_called_once_with('mock_unit')
示例5: test_get_total_for_none
# 需要導入模塊: from pulp.plugins.util.publish_step import UnitPublishStep [as 別名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import parent [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)
示例6: test_process_step_skip_units
# 需要導入模塊: from pulp.plugins.util.publish_step import UnitPublishStep [as 別名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import parent [as 別名]
def test_process_step_skip_units(self):
self.publisher.config = PluginCallConfiguration(None, {'skip': ['FOO']})
step = UnitPublishStep('foo_step', 'FOO')
step.parent = self.publisher
step.process()
self.assertEquals(step.state, reporting_constants.STATE_SKIPPED)