summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-03-17 06:38:56 -0300
committerdrebs <drebs@leap.se>2017-04-04 18:27:34 +0200
commit8cdc69fdc45e1efe06b887f9781427ff6cf64e9f (patch)
tree189ba2b130f390c648185f5315dc2b140afac4e5
parent8c76d22cde068e46937309fb5fd019a9c201cb3b (diff)
[test] check FS backend read
-rw-r--r--testing/tests/blobs/test_fs_backend.py (renamed from testing/tests/blobs/test_backend.py)13
1 files changed, 13 insertions, 0 deletions
diff --git a/testing/tests/blobs/test_backend.py b/testing/tests/blobs/test_fs_backend.py
index 62d1efa2..cd4f1b14 100644
--- a/testing/tests/blobs/test_backend.py
+++ b/testing/tests/blobs/test_fs_backend.py
@@ -35,3 +35,16 @@ class FilesystemBackendTestCase(unittest.TestCase):
backend.tag_header('user', 'blob_id', request)
expected_method.assert_called_once_with('Tag', [expected_tag])
+
+ def test_read_blob(self):
+ render_mock = Mock()
+ _blobs.static.File = Mock(return_value=render_mock)
+ backend = _blobs.FilesystemBlobsBackend()
+ request = object()
+ backend._get_path = Mock(return_value='path')
+ backend.read_blob('user', 'blob_id', request)
+
+ backend._get_path.assert_called_once_with('user', 'blob_id')
+ ctype = 'application/octet-stream'
+ _blobs.static.File.assert_called_once_with('path', defaultType=ctype)
+ render_mock.render_GET.assert_called_once_with(request)