mirror of
https://github.com/wassname/flask-cloudy.git
synced 2026-09-09 11:22:27 +08:00
add unit-test
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user