|
4 | 4 | import aiohttp.web
|
5 | 5 | import asyncio
|
6 | 6 |
|
| 7 | +from lbry.file.source import ManagedDownloadSource |
7 | 8 | from lbry.utils import aiohttp_request
|
8 | 9 | from lbry.blob.blob_file import MAX_BLOB_SIZE
|
9 | 10 | from lbry.testcase import CommandTestCase
|
@@ -354,10 +355,15 @@ async def test_file_save_stop_before_finished_streaming_only(self, wait_for_star
|
354 | 355 | if wait_for_start_writing:
|
355 | 356 | await stream.started_writing.wait()
|
356 | 357 | self.assertTrue(os.path.isfile(path))
|
357 |
| - await self._restart_stream_manager() |
| 358 | + await self.daemon.file_manager.stop() |
| 359 | + # while stopped, we get no response to query and no file is present |
| 360 | + self.assertEqual((await self.daemon.jsonrpc_file_list())['items'], []) |
| 361 | + self.assertEqual(os.path.isfile(path), stream.status == ManagedDownloadSource.STATUS_FINISHED) |
| 362 | + await self.daemon.file_manager.start() |
| 363 | + # after restart, we get a response to query and same file path |
358 | 364 | stream = (await self.daemon.jsonrpc_file_list())['items'][0]
|
359 | 365 | self.assertIsNotNone(stream.full_path)
|
360 |
| - self.assertFalse(os.path.isfile(path)) |
| 366 | + self.assertEqual(stream.full_path, path) |
361 | 367 | if wait_for_start_writing:
|
362 | 368 | await stream.started_writing.wait()
|
363 | 369 | self.assertTrue(os.path.isfile(path))
|
|
0 commit comments