summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/src/leap/soledad/client/_database/blobs.py4
-rw-r--r--testing/tests/blobs/test_sqlcipher_client_backend.py11
2 files changed, 15 insertions, 0 deletions
diff --git a/client/src/leap/soledad/client/_database/blobs.py b/client/src/leap/soledad/client/_database/blobs.py
index 79404bf3..4976fe4d 100644
--- a/client/src/leap/soledad/client/_database/blobs.py
+++ b/client/src/leap/soledad/client/_database/blobs.py
@@ -359,6 +359,10 @@ class SQLiteBlobBackend(object):
result = yield self.dbpool.runQuery(query, (blob_id,))
defer.returnValue(bool(len(result)))
+ def delete(self, blob_id):
+ query = 'DELETE FROM blobs WHERE blob_id = ?'
+ return self.dbpool.runQuery(query, (blob_id,))
+
def _init_blob_table(conn):
maybe_create = (
diff --git a/testing/tests/blobs/test_sqlcipher_client_backend.py b/testing/tests/blobs/test_sqlcipher_client_backend.py
index 865a64e1..45488a9e 100644
--- a/testing/tests/blobs/test_sqlcipher_client_backend.py
+++ b/testing/tests/blobs/test_sqlcipher_client_backend.py
@@ -51,6 +51,17 @@ class SQLBackendTestCase(unittest.TestCase):
@defer.inlineCallbacks
@pytest.mark.usefixtures("method_tmpdir")
+ def test_delete(self):
+ blob_id = 'blob_id'
+ content = "x"
+ yield self.local.put(blob_id, BytesIO(content), len(content))
+ yield self.local.put('remains', BytesIO(content), len(content))
+ yield self.local.delete(blob_id)
+ self.assertFalse((yield self.local.exists(blob_id)))
+ self.assertTrue((yield self.local.exists('remains')))
+
+ @defer.inlineCallbacks
+ @pytest.mark.usefixtures("method_tmpdir")
def test_list(self):
blob_ids = [('blob_id%s' % i) for i in range(10)]
content = "x"