mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-02-23 16:49:59 -05:00
Add some tests
This commit is contained in:
parent
2b96456685
commit
19dfe05707
25
tests.py
Normal file
25
tests.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import unittest
|
||||||
|
|
||||||
|
import main
|
||||||
|
|
||||||
|
|
||||||
|
class FlaskrTestCase(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
main.app.testing = True
|
||||||
|
self.app = main.app.test_client()
|
||||||
|
|
||||||
|
def test_get_root(self):
|
||||||
|
rv = self.app.get('/')
|
||||||
|
self.assertIn(b'mat2-web', rv.data)
|
||||||
|
|
||||||
|
def test_get_download_dangerous_file(self):
|
||||||
|
rv = self.app.get('/download/\..\filename')
|
||||||
|
self.assertEqual(rv.status_code, 302)
|
||||||
|
|
||||||
|
def test_get_download_nonexistant_file(self):
|
||||||
|
rv = self.app.get('/download/non_existant')
|
||||||
|
self.assertEqual(rv.status_code, 302)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user