本文整理汇总了Python中nectar.report.DownloadReport.error_report方法的典型用法代码示例。如果您正苦于以下问题:Python DownloadReport.error_report方法的具体用法?Python DownloadReport.error_report怎么用?Python DownloadReport.error_report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nectar.report.DownloadReport
的用法示例。
在下文中一共展示了DownloadReport.error_report方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__raise_path_error_not_found
# 需要导入模块: from nectar.report import DownloadReport [as 别名]
# 或者: from nectar.report.DownloadReport import error_report [as 别名]
def test__raise_path_error_not_found(self):
"""
For a standard error like 404, the report's error message should be used.
"""
report = DownloadReport('http://foo/bar', '/a/b/c')
report.error_report = {'response_code': httplib.NOT_FOUND}
report.error_msg = 'oops'
with self.assertRaises(IOError) as assertion:
registry.V2Repository._raise_path_error(report)
self.assertEqual(assertion.exception.message, report.error_msg)
示例2: test_download_failed_during_manifest
# 需要导入模块: from nectar.report import DownloadReport [as 别名]
# 或者: from nectar.report.DownloadReport import error_report [as 别名]
def test_download_failed_during_manifest(self):
self.iso_sync_run.progress_report._state = SyncProgressReport.STATE_MANIFEST_IN_PROGRESS
url = 'http://www.theonion.com/articles/' +\
'american-airlines-us-airways-merge-to-form-worlds,31302/'
report = DownloadReport(url, '/fake/destination')
report.error_report = {'why': 'because'}
self.iso_sync_run.download_failed(report)
# The manifest_state should be failed
self.assertEqual(self.iso_sync_run.progress_report._state,
SyncProgressReport.STATE_MANIFEST_FAILED)
self.assertEqual(self.iso_sync_run.progress_report.error_message, report.error_report)
示例3: test__raise_path_error_unathorized
# 需要导入模块: from nectar.report import DownloadReport [as 别名]
# 或者: from nectar.report.DownloadReport import error_report [as 别名]
def test__raise_path_error_unathorized(self):
"""
Specifically for a 401, a custom error message should be used explaining that the cause
could be either that the client is unauthorized, or that the resource was not found.
Docker hub responds 401 for the not found case, which is why this function exists.
"""
report = DownloadReport('http://foo/bar', '/a/b/c')
report.error_report = {'response_code': httplib.UNAUTHORIZED}
report.error_msg = 'oops'
with self.assertRaises(IOError) as assertion:
registry.V2Repository._raise_path_error(report)
# not worrying about what the exact contents are; just that the function added its
# own message
self.assertNotEqual(assertion.exception.message, report.error_msg)
self.assertTrue(len(assertion.exception.message) > 0)