fix test_timeout in test_Downloader

This commit is contained in:
Kay Kurokawa 2017-09-28 11:04:36 -04:00 committed by Jack Robison
parent d2b91d5f51
commit 89ebed570e
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF

View file

@ -115,26 +115,26 @@ class GetStreamTests(unittest.TestCase):
yield getstream.start(stream_info,name) yield getstream.start(stream_info,name)
self.assertFalse(getstream.pay_key_fee_called) self.assertFalse(getstream.pay_key_fee_called)
# @defer.inlineCallbacks @defer.inlineCallbacks
# def test_timeout(self): def test_timeout(self):
# """ """
# test that timeout (set to 2 here) exception is raised test that timeout (set to 3 here) exception is raised
# when download times out while downloading first blob, and key fee is paid when download times out while downloading first blob, and key fee is paid
# """ """
# getstream = self.init_getstream_with_mocs() getstream = self.init_getstream_with_mocs()
# getstream._initialize = types.MethodType(moc_initialize, getstream) getstream._initialize = types.MethodType(moc_initialize, getstream)
# getstream._download_sd_blob = types.MethodType(moc_download_sd_blob, getstream) getstream._download_sd_blob = types.MethodType(moc_download_sd_blob, getstream)
# getstream._download = types.MethodType(moc_download, getstream) getstream._download = types.MethodType(moc_download, getstream)
# getstream.pay_key_fee = types.MethodType(moc_pay_key_fee, getstream) getstream.pay_key_fee = types.MethodType(moc_pay_key_fee, getstream)
# name='test' name='test'
# stream_info = None stream_info = None
# start = getstream.start(stream_info,name) start = getstream.start(stream_info,name)
# self.clock.advance(1) self.clock.advance(1)
# self.clock.advance(1) self.clock.advance(1)
# with self.assertRaises(DownloadDataTimeout): self.clock.advance(1)
# yield start with self.assertRaises(DownloadDataTimeout):
# self.assertTrue(getstream.downloader.stop_called) yield start
# self.assertTrue(getstream.pay_key_fee_called) self.assertTrue(getstream.pay_key_fee_called)
@defer.inlineCallbacks @defer.inlineCallbacks
def test_finish_one_blob(self): def test_finish_one_blob(self):