summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/soledad/client/_db/blobs.py8
-rw-r--r--tests/server/test_blobs_server.py8
2 files changed, 14 insertions, 2 deletions
diff --git a/src/leap/soledad/client/_db/blobs.py b/src/leap/soledad/client/_db/blobs.py
index 31964a6c..6d47999a 100644
--- a/src/leap/soledad/client/_db/blobs.py
+++ b/src/leap/soledad/client/_db/blobs.py
@@ -58,6 +58,10 @@ class BlobAlreadyExistsError(SoledadError):
pass
+class BlobNotFoundError(SoledadError):
+ pass
+
+
class InvalidFlagsError(SoledadError):
pass
@@ -375,8 +379,8 @@ class BlobManager(object):
params.update({'only_flags': True})
response = yield self._client.get(uri, params=params)
if response.code == 404:
- logger.warn("Blob not found in server: %s" % blob_id)
- defer.returnValue(None)
+ logger.error("Blob not found in server: %r" % blob_id)
+ raise BlobNotFoundError(blob_id)
defer.returnValue((yield response.json()))
@defer.inlineCallbacks
diff --git a/tests/server/test_blobs_server.py b/tests/server/test_blobs_server.py
index 9eddf108..2ee6fda2 100644
--- a/tests/server/test_blobs_server.py
+++ b/tests/server/test_blobs_server.py
@@ -80,6 +80,14 @@ class BlobServerTestCase(unittest.TestCase):
@defer.inlineCallbacks
@pytest.mark.usefixtures("method_tmpdir")
+ def test_get_flags_raises_if_no_blob_found(self):
+ manager = BlobManager('', self.uri, self.secret,
+ self.secret, uuid4().hex)
+ with pytest.raises(SoledadError):
+ yield manager.get_flags('missing_id')
+
+ @defer.inlineCallbacks
+ @pytest.mark.usefixtures("method_tmpdir")
def test_list_filter_flag(self):
manager = BlobManager('', self.uri, self.secret,
self.secret, uuid4().hex)