fix tests

This commit is contained in:
Jack Robison 2019-04-04 22:02:33 -04:00
parent 04ddee7d89
commit 7a160f7335
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 5 additions and 7 deletions

View file

@ -394,6 +394,7 @@ class StreamManager:
error = err
if stream and stream.descriptor:
await self.storage.delete_stream(stream.descriptor)
await self.blob_manager.delete_blob(stream.sd_hash)
finally:
if self.analytics_manager and (error or (stream and (stream.downloader.time_to_descriptor or
stream.downloader.time_to_first_bytes))):

View file

@ -59,14 +59,11 @@ class FileCommands(CommandTestCase):
await self.daemon.stream_manager.start()
await asyncio.wait_for(self.wait_files_to_complete(), timeout=5) # if this hangs, file didnt get set completed
# check that internal state got through up to the file list API
downloader = self.daemon.stream_manager.get_stream_by_stream_hash(file_info['stream_hash']).downloader
file_info = self.sout(self.daemon.jsonrpc_file_list())[0]
self.assertEqual(downloader.output_file_name, file_info['file_name'])
stream = self.daemon.stream_manager.get_stream_by_stream_hash(file_info['stream_hash'])
file_info = self.daemon.jsonrpc_file_list()[0]
self.assertEqual(stream.file_name, file_info['file_name'])
# checks if what the API shows is what he have at the very internal level.
self.assertEqual(downloader.output_path, file_info['download_path'])
# if you got here refactoring just change above, but ensure what gets set internally gets reflected externally!
self.assertTrue(downloader.output_path.endswith(downloader.output_file_name))
# this used to be inconsistent, if it becomes again it would create weird bugs, so worth checking
self.assertEqual(stream.full_path, file_info['download_path'])
async def test_incomplete_downloads_erases_output_file_on_stop(self):
tx = await self.stream_create('foo', '0.01')