add unit-test

This commit is contained in:
Alexey Vasilyev
2015-10-16 16:55:59 +02:00
parent 9a5de18443
commit 6f6627b746
+16
View File
@@ -165,3 +165,19 @@ def test_save_to():
assert os.path.isfile(file)
assert file2 == CWD + "/data/my_new_file.txt"
def test_werkzeug_upload():
try:
import werkzeug
except ImportError:
return
storage = app_storage()
object_name = "my-txt-hello.txt"
filepath = CWD + "/data/hello.txt"
file = None
with open(filepath, 'rb') as fp:
file = werkzeug.datastructures.FileStorage(fp)
file.filename = object_name
o = storage.upload(file, overwrite=True)
assert isinstance(o, Object)
assert o.name == object_name