From 6da5ce6286336f5945e2eff5ceb0ae10116f8546 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 27 Mar 2017 23:13:58 -0300 Subject: [feature] add send_missing to send pending uploads This method will gather a list of local docs and a list of remote docs, compare them and send docs which server doesn't have. - Related: #8807 --- testing/tests/blobs/test_local_backend.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'testing/tests/blobs') diff --git a/testing/tests/blobs/test_local_backend.py b/testing/tests/blobs/test_local_backend.py index 5bfece8f..297f0389 100644 --- a/testing/tests/blobs/test_local_backend.py +++ b/testing/tests/blobs/test_local_backend.py @@ -100,3 +100,15 @@ class BlobManagerTestCase(unittest.TestCase): blobs_list = yield self.manager.local_list() self.assertEquals(set(['myblob_id', 'myblob_id2']), set(blobs_list)) + + @defer.inlineCallbacks + @pytest.mark.usefixtures("method_tmpdir") + def test_send_missing(self): + fd = BytesIO('test') + self.manager._encrypt_and_upload = Mock(return_value=None) + self.manager.remote_list = Mock(return_value=[]) + self.manager.local_list = Mock(return_value=['missing_id']) + self.manager.local = Mock(get=Mock(return_value=fd)) + yield self.manager.send_missing() + + self.manager._encrypt_and_upload.assert_called_with('missing_id', fd) -- cgit v1.2.3