本文整理汇总了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)
示例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)