summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/soledad/client/_db/blobs.py8
-rw-r--r--testing/tests/server/test_blobs_server.py14
2 files changed, 18 insertions, 4 deletions
diff --git a/src/leap/soledad/client/_db/blobs.py b/src/leap/soledad/client/_db/blobs.py
index f693ec20..bd718f18 100644
--- a/src/leap/soledad/client/_db/blobs.py
+++ b/src/leap/soledad/client/_db/blobs.py
@@ -307,16 +307,16 @@ class BlobManager(object):
defer.returnValue((fd, size))
@defer.inlineCallbacks
- def delete(self, blob_id):
+ def delete(self, blob_id, **params):
logger.info("Staring deletion of blob: %s" % blob_id)
- yield self._delete_from_remote(blob_id)
+ yield self._delete_from_remote(blob_id, **params)
if (yield self.local.exists(blob_id)):
yield self.local.delete(blob_id)
- def _delete_from_remote(self, blob_id):
+ def _delete_from_remote(self, blob_id, **params):
# TODO this needs to be connected in a tube
uri = urljoin(self.remote, self.user + '/' + blob_id)
- return self._client.delete(uri)
+ return self._client.delete(uri, params=params)
class SQLiteBlobBackend(object):
diff --git a/testing/tests/server/test_blobs_server.py b/testing/tests/server/test_blobs_server.py
index 0696e14b..249d76bc 100644
--- a/testing/tests/server/test_blobs_server.py
+++ b/testing/tests/server/test_blobs_server.py
@@ -203,3 +203,17 @@ class BlobServerTestCase(unittest.TestCase):
yield manager._delete_from_remote('blob_id1')
blobs_list = yield manager.remote_list()
self.assertEquals(set(['blob_id2']), set(blobs_list))
+
+ @defer.inlineCallbacks
+ @pytest.mark.usefixtures("method_tmpdir")
+ def test_upload_then_delete_updates_list_using_namespace(self):
+ manager = BlobManager('', self.uri, self.secret,
+ self.secret, 'user')
+ namespace = 'special_archives'
+ yield manager._encrypt_and_upload('blob_id1', BytesIO("1"),
+ namespace=namespace)
+ yield manager._encrypt_and_upload('blob_id2', BytesIO("2"),
+ namespace=namespace)
+ yield manager._delete_from_remote('blob_id1', namespace=namespace)
+ blobs_list = yield manager.remote_list(namespace=namespace)
+ self.assertEquals(set(['blob_id2']), set(blobs_list))