summaryrefslogtreecommitdiff
path: root/testing/tests/server/test_blobs_server.py
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-07-07 02:58:09 -0300
committerdrebs <drebs@leap.se>2017-07-18 15:30:30 -0300
commit1aa9dee0ce87434188d37c821617caeff24fd70f (patch)
treead95887aa4b7c598390d994aaa109bf8aa6e2fb9 /testing/tests/server/test_blobs_server.py
parent679e1bb7990fc1fc9c4971db6383a75ae6acab80 (diff)
[feature] add namespace support for BlobsManager
'namespace' argument is supported by backend but not yet exposed on API for clients. Since IncomingBox makes heavy usage of it, this commit exposes the argument as a query string for clients to use it.
Diffstat (limited to 'testing/tests/server/test_blobs_server.py')
-rw-r--r--testing/tests/server/test_blobs_server.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/testing/tests/server/test_blobs_server.py b/testing/tests/server/test_blobs_server.py
index bbb1b6d5..f4c9119b 100644
--- a/testing/tests/server/test_blobs_server.py
+++ b/testing/tests/server/test_blobs_server.py
@@ -80,6 +80,18 @@ class BlobServerTestCase(unittest.TestCase):
blobs_list = yield manager.remote_list(order_by='-date')
self.assertEquals(['blob_id1', 'blob_id2'], blobs_list)
+ @defer.inlineCallbacks
+ @pytest.mark.usefixtures("method_tmpdir")
+ def test_list_restricted_by_namespace(self):
+ manager = BlobManager('', self.uri, self.secret,
+ self.secret, 'user')
+ namespace = 'incoming'
+ yield manager._encrypt_and_upload('blob_id1', BytesIO("1"),
+ namespace=namespace)
+ yield manager._encrypt_and_upload('blob_id2', BytesIO("2"))
+ blobs_list = yield manager.remote_list(namespace=namespace)
+ self.assertEquals(['blob_id1'], blobs_list)
+
def __touch(self, *args):
path = os.path.join(*args)
with open(path, 'a'):