summaryrefslogtreecommitdiff
path: root/tests/blobs/test_blob_manager.py
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-11-11 01:48:16 -0300
committerVictor Shyba <victor1984@riseup.net>2017-11-13 18:17:16 -0300
commit1d4f43570345fc644b42a96dfd70cd72435f55fd (patch)
tree9bea2f2e10b5562bff28fa30c6a5ba5387d2bd33 /tests/blobs/test_blob_manager.py
parent8f3fdc2f9c3d4360669c2c7fd89dbd95e0f8dd22 (diff)
[feature] support unsynced local_only blobs
Adds the ability to have document that wont be synced. This enables applications to use soledad to store temporary blobs that should be discarded later instead of unnecessarily keeping the sync loop busy. -- Resolves: #8819
Diffstat (limited to 'tests/blobs/test_blob_manager.py')
-rw-r--r--tests/blobs/test_blob_manager.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/blobs/test_blob_manager.py b/tests/blobs/test_blob_manager.py
index 58f99790..c7bbb0d3 100644
--- a/tests/blobs/test_blob_manager.py
+++ b/tests/blobs/test_blob_manager.py
@@ -83,6 +83,19 @@ class BlobManagerTestCase(unittest.TestCase):
@defer.inlineCallbacks
@pytest.mark.usefixtures("method_tmpdir")
+ def test_put_local_only_doesnt_send_to_server(self):
+ self.manager._encrypt_and_upload = Mock(return_value=None)
+ msg, blob_id = "Hey Joe", uuid4().hex
+ doc = BlobDoc(BytesIO(msg), blob_id=blob_id)
+ yield self.manager.put(doc, size=len(msg), local_only=True)
+ result = yield self.manager.local.get(blob_id)
+ status, _ = yield self.manager.local.get_sync_status(blob_id)
+ self.assertEquals(result.getvalue(), msg)
+ self.assertEquals(status, SyncStatus.LOCAL_ONLY)
+ self.assertFalse(self.manager._encrypt_and_upload.called)
+
+ @defer.inlineCallbacks
+ @pytest.mark.usefixtures("method_tmpdir")
def test_put_then_get_using_real_file_descriptor(self):
self.manager._encrypt_and_upload = Mock(return_value=None)
self.manager._download_and_decrypt = Mock(return_value=None)