Skip to content

Commit 4e47498

Browse files
committed
Test if file has been uploaded successfully.
1 parent 2134b9a commit 4e47498

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ __pycache__
22
*.pyc
33
.data
44
.cache
5-
.coverage
5+
.coverage

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def teardown():
1919
ctx.pop()
2020

2121
request.addfinalizer(teardown)
22+
return filestore_app
2223

2324

2425
@pytest.fixture(scope="session")

tests/test_general.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from cStringIO import StringIO
2+
import os
23

34

45
class TestGeneral(object):
@@ -19,3 +20,10 @@ def test_save_suffix(self, client):
1920
url = client.post(
2021
"/save", data=dict(file=(file, "hello.txt"), suffix=suffix)).data
2122
assert url[-len(suffix):] == suffix
23+
24+
def test_retrieved(self, app, client):
25+
data = "the quick brown fox jumps over the lazy dog"
26+
file = StringIO(data)
27+
url = client.post("/save", data=dict(file=(file, "hello.txt"))).data
28+
with open(os.path.join(app.config["UPLOAD_FOLDER"], url), "r") as f:
29+
assert f.read() == data

0 commit comments

Comments
 (0)