From 2247b354b3ae6f0c8b648df4cabea2d57e7da95d Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 6 May 2019 17:27:12 -0300 Subject: [PATCH] integration test for announcing both on publish and download --- tests/integration/test_file_commands.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/integration/test_file_commands.py b/tests/integration/test_file_commands.py index 419afd8cf..78cbd2d07 100644 --- a/tests/integration/test_file_commands.py +++ b/tests/integration/test_file_commands.py @@ -28,6 +28,24 @@ class FileCommands(CommandTestCase): await self.daemon.jsonrpc_get('lbry://foo') self.assertEqual(len(self.daemon.jsonrpc_file_list()), 1) + async def test_announces(self): + # announces on publish + self.assertEqual(await self.daemon.storage.get_blobs_to_announce(), []) + await self.stream_create('foo', '0.01') + stream = self.daemon.jsonrpc_file_list()[0] + self.assertSetEqual( + set(await self.daemon.storage.get_blobs_to_announce()), + {stream.sd_hash, stream.descriptor.blobs[0].blob_hash} + ) + self.assertTrue(await self.daemon.jsonrpc_file_delete(delete_all=True)) + # announces on download + self.assertEqual(await self.daemon.storage.get_blobs_to_announce(), []) + stream = await self.daemon.jsonrpc_get('foo') + self.assertSetEqual( + set(await self.daemon.storage.get_blobs_to_announce()), + {stream.sd_hash, stream.descriptor.blobs[0].blob_hash} + ) + async def test_file_list_fields(self): await self.stream_create('foo', '0.01') file_list = self.sout(self.daemon.jsonrpc_file_list())