summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-03-17 06:54:34 -0300
committerdrebs <drebs@leap.se>2017-04-04 18:27:34 +0200
commit4da20addb409c6999c10bdacece7bb5e786ee69e (patch)
treeb091a377beb6f9820d7e01954fb1001b7b7b2fb7
parent8cdc69fdc45e1efe06b887f9781427ff6cf64e9f (diff)
[test] check blobs server cant overwrite
-rw-r--r--testing/tests/blobs/test_fs_backend.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/testing/tests/blobs/test_fs_backend.py b/testing/tests/blobs/test_fs_backend.py
index cd4f1b14..ee388561 100644
--- a/testing/tests/blobs/test_fs_backend.py
+++ b/testing/tests/blobs/test_fs_backend.py
@@ -22,6 +22,7 @@ from leap.soledad.server import _blobs
from io import BytesIO
from mock import Mock
import base64
+import pytest
class FilesystemBackendTestCase(unittest.TestCase):
@@ -48,3 +49,10 @@ class FilesystemBackendTestCase(unittest.TestCase):
ctype = 'application/octet-stream'
_blobs.static.File.assert_called_once_with('path', defaultType=ctype)
render_mock.render_GET.assert_called_once_with(request)
+
+ def test_cannot_overwrite(self):
+ _blobs.os.path.isfile = lambda path: True
+ backend = _blobs.FilesystemBlobsBackend()
+ backend._get_path = Mock(return_value='path')
+ with pytest.raises(_blobs.BlobAlreadyExists):
+ backend.write_blob('user', 'blob_id', 'request')