mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-05-13 03:32:18 -04:00
Add some tests
This commit is contained in:
parent
2b96456685
commit
19dfe05707
1 changed files with 25 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue