forked from LBRYCommunity/lbry-sdk
add file_save integration tests
This commit is contained in:
parent
3a997277aa
commit
35479dcbd2
2 changed files with 26 additions and 0 deletions
|
@ -325,6 +325,11 @@ class Examples(CommandTestCase):
|
||||||
'get', file_uri
|
'get', file_uri
|
||||||
)
|
)
|
||||||
|
|
||||||
|
await r(
|
||||||
|
'Save a file to the downloads directory',
|
||||||
|
'file', 'save', f"--sd_hash=\"{file_list_result[0]['sd_hash']}\""
|
||||||
|
)
|
||||||
|
|
||||||
# blobs
|
# blobs
|
||||||
|
|
||||||
bloblist = await r(
|
bloblist = await r(
|
||||||
|
|
|
@ -311,3 +311,24 @@ class RangeRequests(CommandTestCase):
|
||||||
await self._test_range_requests()
|
await self._test_range_requests()
|
||||||
self.assertEqual(start_file_count, len(os.listdir(self.daemon.blob_manager.blob_dir)))
|
self.assertEqual(start_file_count, len(os.listdir(self.daemon.blob_manager.blob_dir)))
|
||||||
self.assertEqual(blobs_in_stream, self.daemon.jsonrpc_file_list()[0].blobs_remaining)
|
self.assertEqual(blobs_in_stream, self.daemon.jsonrpc_file_list()[0].blobs_remaining)
|
||||||
|
|
||||||
|
async def test_file_save_streaming_only_save_blobs(self):
|
||||||
|
await self.test_streaming_only_with_blobs()
|
||||||
|
stream = self.daemon.jsonrpc_file_list()[0]
|
||||||
|
self.assertIsNone(stream.full_path)
|
||||||
|
self.server.stop_server()
|
||||||
|
await self.daemon.jsonrpc_file_save('test', self.daemon.conf.data_dir)
|
||||||
|
stream = self.daemon.jsonrpc_file_list()[0]
|
||||||
|
await stream.finished_writing.wait()
|
||||||
|
with open(stream.full_path, 'rb') as f:
|
||||||
|
self.assertEqual(self.data, f.read())
|
||||||
|
|
||||||
|
async def test_file_save_streaming_only_dont_save_blobs(self):
|
||||||
|
await self.test_streaming_only_without_blobs()
|
||||||
|
stream = self.daemon.jsonrpc_file_list()[0]
|
||||||
|
self.assertIsNone(stream.full_path)
|
||||||
|
await self.daemon.jsonrpc_file_save('test', self.daemon.conf.data_dir)
|
||||||
|
stream = self.daemon.jsonrpc_file_list()[0]
|
||||||
|
await stream.finished_writing.wait()
|
||||||
|
with open(stream.full_path, 'rb') as f:
|
||||||
|
self.assertEqual(self.data, f.read())
|
||||||
|
|
Loading…
Reference in a new issue