diff options
author | Victor Shyba <victor1984@riseup.net> | 2017-07-13 02:02:39 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2017-07-21 10:58:47 -0300 |
commit | 5d521e5a1c5fdd4cf926062dc26147dbcd110b05 (patch) | |
tree | 97a2e5e7bb20c3b01e89ca5ab79cc1cc124502e9 /testing/tests/server | |
parent | 64107009a869a6ddb6cea129e65735d9740e697b (diff) |
[feature] add possibility to count on blob manager
By using `only_count=True` parameter, instead of returning a full list,
server just count the amount of blobs.
-- Resolves: #8871
Diffstat (limited to 'testing/tests/server')
-rw-r--r-- | testing/tests/server/test_blobs_server.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/testing/tests/server/test_blobs_server.py b/testing/tests/server/test_blobs_server.py index 0db64256..0696e14b 100644 --- a/testing/tests/server/test_blobs_server.py +++ b/testing/tests/server/test_blobs_server.py @@ -128,6 +128,19 @@ class BlobServerTestCase(unittest.TestCase): @defer.inlineCallbacks @pytest.mark.usefixtures("method_tmpdir") + def test_list_with_count_parameter(self): + manager = BlobManager('', self.uri, self.secret, + self.secret, 'user') + deferreds = [] + for i in range(10): + deferreds.append(manager._encrypt_and_upload(str(i), BytesIO("1"))) + yield defer.gatherResults(deferreds) + + result = yield manager.remote_list(only_count=True) + self.assertEquals({"count": len(deferreds)}, result) + + @defer.inlineCallbacks + @pytest.mark.usefixtures("method_tmpdir") def test_list_restricted_by_namespace(self): manager = BlobManager('', self.uri, self.secret, self.secret, 'user') |