summaryrefslogtreecommitdiff
path: root/testing/tests
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-07-24 18:11:14 -0300
committerVictor Shyba <victor1984@riseup.net>2017-08-03 05:33:01 -0300
commit841db9f072401f2b6f40873b35c733723a54de36 (patch)
treedb64800de5858aca58f42547e4086a79274e7dfd /testing/tests
parent8fc244cb0946f46ba9aff019b70568d08a226b29 (diff)
[bug] make download namespace-aware
Diffstat (limited to 'testing/tests')
-rw-r--r--testing/tests/blobs/test_blob_manager.py3
-rw-r--r--testing/tests/server/test_blobs_server.py11
2 files changed, 13 insertions, 1 deletions
diff --git a/testing/tests/blobs/test_blob_manager.py b/testing/tests/blobs/test_blob_manager.py
index 5b96cae0..56bea87a 100644
--- a/testing/tests/blobs/test_blob_manager.py
+++ b/testing/tests/blobs/test_blob_manager.py
@@ -50,7 +50,8 @@ class BlobManagerTestCase(unittest.TestCase):
bad_blob_id = 'inexsistent_id'
result = yield self.manager.get(bad_blob_id)
self.assertIsNone(result)
- self.manager._download_and_decrypt.assert_called_once_with(bad_blob_id)
+ args = bad_blob_id, None
+ self.manager._download_and_decrypt.assert_called_once_with(*args)
@defer.inlineCallbacks
@pytest.mark.usefixtures("method_tmpdir")
diff --git a/testing/tests/server/test_blobs_server.py b/testing/tests/server/test_blobs_server.py
index 152215d1..cf370147 100644
--- a/testing/tests/server/test_blobs_server.py
+++ b/testing/tests/server/test_blobs_server.py
@@ -192,6 +192,17 @@ class BlobServerTestCase(unittest.TestCase):
blobs_list = yield manager.remote_list(namespace=namespace)
self.assertEquals(['blob_id1'], blobs_list)
+ @defer.inlineCallbacks
+ @pytest.mark.usefixtures("method_tmpdir")
+ def test_download_from_namespace(self):
+ manager = BlobManager('', self.uri, self.secret,
+ self.secret, 'user')
+ namespace, blob_id, content = 'incoming', 'blob_id1', 'test'
+ yield manager._encrypt_and_upload(blob_id, BytesIO(content),
+ namespace=namespace)
+ got_blob = yield manager._download_and_decrypt(blob_id, namespace)
+ self.assertEquals(content, got_blob[0].getvalue())
+
def __touch(self, *args):
path = os.path.join(*args)
with open(path, 'a'):