当前位置: 首页>>代码示例>>Python>>正文


Python UnitPublishStep.process_unit方法代码示例

本文整理汇总了Python中pulp.plugins.util.publish_step.UnitPublishStep.process_unit方法的典型用法代码示例。如果您正苦于以下问题:Python UnitPublishStep.process_unit方法的具体用法?Python UnitPublishStep.process_unit怎么用?Python UnitPublishStep.process_unit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pulp.plugins.util.publish_step.UnitPublishStep的用法示例。


在下文中一共展示了UnitPublishStep.process_unit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_process_step_no_units

# 需要导入模块: from pulp.plugins.util.publish_step import UnitPublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import process_unit [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)
开发者ID:hgschmie,项目名称:pulp,代码行数:12,代码来源:test_publish_step.py

示例2: test_process_step_cancelled_mid_unit_processing

# 需要导入模块: from pulp.plugins.util.publish_step import UnitPublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import process_unit [as 别名]
    def test_process_step_cancelled_mid_unit_processing(self, mock_get_units):
        self.publisher.repo.content_unit_counts = {'FOO_TYPE': 2}
        mock_get_units.return_value = ['cancel', 'bar_unit']
        step = UnitPublishStep('foo_step', 'FOO_TYPE')
        self.publisher.add_child(step)

        step.process_unit = self._step_canceler
        step.process()

        self.assertEquals(step.state, reporting_constants.STATE_CANCELLED)
        self.assertEquals(step.progress_successes, 1)
        self.assertEquals(step.progress_failures, 0)
        self.assertEquals(step.total_units, 2)
开发者ID:hgschmie,项目名称:pulp,代码行数:15,代码来源:test_publish_step.py

示例3: test_process_step_single_unit_exception

# 需要导入模块: from pulp.plugins.util.publish_step import UnitPublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import process_unit [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')
开发者ID:hgschmie,项目名称:pulp,代码行数:16,代码来源:test_publish_step.py

示例4: test_process_step_single_unit

# 需要导入模块: from pulp.plugins.util.publish_step import UnitPublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import process_unit [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')
开发者ID:hgschmie,项目名称:pulp,代码行数:16,代码来源:test_publish_step.py

示例5: test_process_unit_with_no_work

# 需要导入模块: from pulp.plugins.util.publish_step import UnitPublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.UnitPublishStep import process_unit [as 别名]
 def test_process_unit_with_no_work(self):
     # Run the blank process unit to ensure no exceptions are raised
     step = UnitPublishStep("foo", ['bar', 'baz'])
     step.process_unit('foo')
开发者ID:hgschmie,项目名称:pulp,代码行数:6,代码来源:test_publish_step.py


注:本文中的pulp.plugins.util.publish_step.UnitPublishStep.process_unit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。