當前位置: 首頁>>代碼示例>>Python>>正文


Python publish_step.UnitPublishStep類代碼示例

本文整理匯總了Python中pulp.plugins.util.publish_step.UnitPublishStep的典型用法代碼示例。如果您正苦於以下問題:Python UnitPublishStep類的具體用法?Python UnitPublishStep怎麽用?Python UnitPublishStep使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了UnitPublishStep類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_total_ignore_filter

 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)
開發者ID:hgschmie,項目名稱:pulp,代碼行數:7,代碼來源:test_publish_step.py

示例2: test_process_step_no_units

 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,代碼行數:10,代碼來源:test_publish_step.py

示例3: test_get_with_association_filter

    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)
開發者ID:hgschmie,項目名稱:pulp,代碼行數:12,代碼來源:test_publish_step.py

示例4: test_process_step_cancelled_mid_unit_processing

    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,代碼行數:13,代碼來源:test_publish_step.py

示例5: test_process_step_single_unit_exception

    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,代碼行數:14,代碼來源:test_publish_step.py

示例6: test_process_step_single_unit

    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,代碼行數:14,代碼來源:test_publish_step.py

示例7: test_process_unit_with_no_work

 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,代碼行數:4,代碼來源:test_publish_step.py

示例8: test_get_total_for_none

 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)
開發者ID:hgschmie,項目名稱:pulp,代碼行數:6,代碼來源:test_publish_step.py

示例9: test_is_skipped_dict_not_skipped

 def test_is_skipped_dict_not_skipped(self):
     step = UnitPublishStep("foo", 'bar')
     step.config = PluginCallConfiguration(None, None)
     self.assertFalse(step.is_skipped())
開發者ID:hgschmie,項目名稱:pulp,代碼行數:4,代碼來源:test_publish_step.py

示例10: test_is_skipped_dict

 def test_is_skipped_dict(self):
     step = UnitPublishStep("foo", 'bar')
     step.config = PluginCallConfiguration(None, {'skip': {'bar': True, 'baz': True}})
     self.assertTrue(step.is_skipped())
開發者ID:hgschmie,項目名稱:pulp,代碼行數:4,代碼來源:test_publish_step.py

示例11: test_process_step_skip_units

 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)
開發者ID:hgschmie,項目名稱:pulp,代碼行數:6,代碼來源:test_publish_step.py

示例12: test_get_with_association_filter

 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)
開發者ID:aweiteka,項目名稱:pulp,代碼行數:5,代碼來源:test_publish_step.py


注:本文中的pulp.plugins.util.publish_step.UnitPublishStep類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。