本文整理汇总了Python中Tribler.Test.Core.base_test.MockObject.msg方法的典型用法代码示例。如果您正苦于以下问题:Python MockObject.msg方法的具体用法?Python MockObject.msg怎么用?Python MockObject.msg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tribler.Test.Core.base_test.MockObject
的用法示例。
在下文中一共展示了MockObject.msg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_resume_data_failed
# 需要导入模块: from Tribler.Test.Core.base_test import MockObject [as 别名]
# 或者: from Tribler.Test.Core.base_test.MockObject import msg [as 别名]
def test_resume_data_failed(self):
"""
Testing whether the correct operations happen when an error is raised during resume data saving
"""
test_deferred = Deferred()
def on_error(_):
test_deferred.callback(None)
mock_alert = MockObject()
mock_alert.msg = "test error"
self.libtorrent_download_impl.deferreds_resume.append(Deferred().addErrback(
self.libtorrent_download_impl._on_resume_err).addCallback(on_error))
self.libtorrent_download_impl.on_save_resume_data_failed_alert(mock_alert)
return test_deferred
示例2: test_process_error_alert
# 需要导入模块: from Tribler.Test.Core.base_test import MockObject [as 别名]
# 或者: from Tribler.Test.Core.base_test.MockObject import msg [as 别名]
def test_process_error_alert(self):
"""
Testing whether error alerts are processed correctly
"""
url = "http://google.com"
mock_alert = MockObject()
mock_alert.msg = None
mock_alert.category = lambda: lt.alert.category_t.error_notification
mock_alert.status_code = 123
mock_alert.url = url
self.libtorrent_download_impl.process_alert(mock_alert, 'tracker_error_alert')
self.assertEqual(self.libtorrent_download_impl.tracker_status[url][1], 'HTTP status code 123')
mock_alert.status_code = 0
self.libtorrent_download_impl.process_alert(mock_alert, 'tracker_error_alert')
self.assertEqual(self.libtorrent_download_impl.tracker_status[url][1], 'Timeout')