本文整理汇总了Python中nectar.report.DownloadReport.state方法的典型用法代码示例。如果您正苦于以下问题:Python DownloadReport.state方法的具体用法?Python DownloadReport.state怎么用?Python DownloadReport.state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nectar.report.DownloadReport
的用法示例。
在下文中一共展示了DownloadReport.state方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_single_path_failure
# 需要导入模块: from nectar.report import DownloadReport [as 别名]
# 或者: from nectar.report.DownloadReport import state [as 别名]
def test_get_single_path_failure(self, mock_download_one):
report = DownloadReport('http://pulpproject.org/v1/repositories/pulp/crane/images',
StringIO(''))
report.headers = {}
report.state = report.DOWNLOAD_FAILED
mock_download_one.return_value = report
self.assertRaises(IOError, self.repo._get_single_path, '/v1/repositories/pulp/crane/images')
示例2: test__get_path_failed
# 需要导入模块: from nectar.report import DownloadReport [as 别名]
# 或者: from nectar.report.DownloadReport import state [as 别名]
def test__get_path_failed(self, mock_download_one, mock_request_token):
"""
Test _get_path() for the case when an IOError is raised by the downloader.
"""
name = 'pulp'
download_config = DownloaderConfig(max_concurrent=25)
registry_url = 'https://registry.example.com'
working_dir = '/a/working/dir'
r = registry.V2Repository(name, download_config, registry_url, working_dir)
report = DownloadReport(registry_url + '/some/path', StringIO())
report.error_report['response_code'] = httplib.UNAUTHORIZED
report.state = DownloadReport.DOWNLOAD_FAILED
mock_download_one.return_value = report
# The request will fail because the requested path does not exist
self.assertRaises(IOError, r._get_path, '/some/path')