From c289edb916502b13e9732192bff6071afe73ad09 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 16 Dec 2018 21:37:15 +0100 Subject: Add a test with a valid file --- tests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests.py') diff --git a/tests.py b/tests.py index 5972474..9f56079 100644 --- a/tests.py +++ b/tests.py @@ -47,6 +47,20 @@ class FlaskrTestCase(unittest.TestCase): rv.data) self.assertEqual(rv.status_code, 200) + def test_get_upload_harmless_file(self): + rv = self.app.post('/', + data=dict( + file=(io.BytesIO(b"Some text"), 'test.txt'), + ), follow_redirects=True) + self.assertIn(b'/download/test.cleaned.txt', rv.data) + self.assertEqual(rv.status_code, 200) + + rv = self.app.get('/download/test.cleaned.txt') + self.assertEqual(rv.status_code, 200) + + rv = self.app.get('/download/test.cleaned.txt') + self.assertEqual(rv.status_code, 302) + if __name__ == '__main__': unittest.main() -- cgit v1.3