From 6f6627b74612d521c69e4123e7cec46c16d99058 Mon Sep 17 00:00:00 2001 From: Alexey Vasilyev Date: Fri, 16 Oct 2015 16:55:59 +0200 Subject: [PATCH] add unit-test --- tests/test_cloudy.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_cloudy.py b/tests/test_cloudy.py index 9f5c027..c777d45 100644 --- a/tests/test_cloudy.py +++ b/tests/test_cloudy.py @@ -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 +