summaryrefslogtreecommitdiff
path: root/testing/tests/blobs
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-03-23 20:33:20 -0300
committerdrebs <drebs@leap.se>2017-04-04 18:27:38 +0200
commit26a65d100f91883027c17c219d018461968eda65 (patch)
tree1c2cdb4a8438aa730f4ac064cfe15ebf843e0740 /testing/tests/blobs
parent45b73d58930a2a66394a6797c94a50c34e8f96e7 (diff)
[feature] add blobs listing
Diffstat (limited to 'testing/tests/blobs')
-rw-r--r--testing/tests/blobs/test_fs_backend.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/testing/tests/blobs/test_fs_backend.py b/testing/tests/blobs/test_fs_backend.py
index ce82fce0..5be6c17d 100644
--- a/testing/tests/blobs/test_fs_backend.py
+++ b/testing/tests/blobs/test_fs_backend.py
@@ -25,6 +25,7 @@ from mock import Mock
import mock
import os
import base64
+import json
import pytest
@@ -86,3 +87,11 @@ class FilesystemBackendTestCase(unittest.TestCase):
backend.path = '/somewhere/'
path = backend._get_path('user', 'blob_id')
assert path == '/somewhere/user/b/blo/blob_i/blob_id'
+
+ @pytest.mark.usefixtures("method_tmpdir")
+ @mock.patch('leap.soledad.server._blobs.os.walk')
+ def test_list_blobs(self, walk_mock):
+ backend, _ = _blobs.FilesystemBlobsBackend(self.tempdir), None
+ walk_mock.return_value = [(_, _, ['blob_0']), (_, _, ['blob_1'])]
+ result = json.loads(backend.list_blobs('user', DummyRequest([''])))
+ assert result == ['blob_0', 'blob_1']