mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-02-23 16:49:59 -05:00
Add a test with a valid file
This commit is contained in:
parent
a71a390145
commit
c289edb916
14
tests.py
14
tests.py
@ -47,6 +47,20 @@ class FlaskrTestCase(unittest.TestCase):
|
|||||||
rv.data)
|
rv.data)
|
||||||
self.assertEqual(rv.status_code, 200)
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user