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


Python SynchronizeWithDirectory._fetch_manifest方法代码示例

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


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

示例1: test_fetch_manifest_failed

# 需要导入模块: from pulp_puppet.plugins.importers.directory import SynchronizeWithDirectory [as 别名]
# 或者: from pulp_puppet.plugins.importers.directory.SynchronizeWithDirectory import _fetch_manifest [as 别名]
    def test_fetch_manifest_failed(self, mock_download):
        feed_url = 'http://host/root/'

        mock_repo = Mock()
        conduit = Mock()
        config = {constants.CONFIG_FEED: feed_url}
        failed_report = Mock()
        failed_report.error_msg = 'just up and failed'

        mock_download.return_value = [], [failed_report]

        # test

        method = SynchronizeWithDirectory(mock_repo, conduit, config)
        method.report = Mock()
        manifest = method._fetch_manifest()

        # validation

        mock_download.assert_called_with([(urljoin(feed_url, constants.MANIFEST_FILENAME), ANY)])

        self.assertTrue(manifest is None)

        self.assertTrue(method.report.update_progress.called)
        self.assertEqual(method.report.metadata_state, constants.STATE_FAILED)
        self.assertEqual(method.report.metadata_error_message, failed_report.error_msg)
        self.assertTrue(method.report.metadata_execution_time > 0)
开发者ID:aeria,项目名称:pulp_puppet,代码行数:29,代码来源:test_directory.py

示例2: test_fetch_manifest

# 需要导入模块: from pulp_puppet.plugins.importers.directory import SynchronizeWithDirectory [as 别名]
# 或者: from pulp_puppet.plugins.importers.directory.SynchronizeWithDirectory import _fetch_manifest [as 别名]
    def test_fetch_manifest(self, mock_download, mock_get_value):
        feed_url = 'http://host/root/'

        mock_repo = Mock()
        conduit = Mock()
        config = {constants.CONFIG_FEED: feed_url}
        succeeded_report = Mock()

        mock_download.return_value = [succeeded_report], []
        mock_get_value.return_value = 'A,B,C\nD,E,F\n'

        # test

        method = SynchronizeWithDirectory(mock_repo, conduit, config)
        method.report = Mock()
        manifest = method._fetch_manifest()

        # validation

        mock_download.assert_called_with([(urljoin(feed_url, constants.MANIFEST_FILENAME), ANY)])

        self.assertEqual(manifest, [('A', 'B', 'C'), ('D', 'E', 'F')])

        self.assertTrue(method.report.update_progress.called)
        self.assertEqual(method.report.metadata_state, constants.STATE_SUCCESS)
        self.assertEqual(method.report.metadata_query_finished_count, 1)
        self.assertEqual(method.report.metadata_query_total_count, 1)
        self.assertEqual(method.report.metadata_current_query, None)
        self.assertTrue(method.report.metadata_execution_time > 0)
开发者ID:aeria,项目名称:pulp_puppet,代码行数:31,代码来源:test_directory.py


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