Test Failed
Push — master ( 54c5ff...b3861f )
by -
01:31
created

FlaskrTestCase.test_lfi()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 4
rs 10
1
from spike import create_app
2
from spike.model import db
3
import unittest
4
5
6
class FlaskrTestCase(unittest.TestCase):
7
    def setUp(self):
8
        app = create_app()
9
        db.init_app(app)
10
        app.config['TESTING'] = True
11
        self.app = app.test_client()
12
13
    def tearDown(self):
14
        pass
15
16
    def test_index(self):
17
        rv = self.app.get('/docs', follow_redirects=True)
18
        self.assertIn('<h2>Spike - Docs - Overview</h2>', rv.data)
19
20
    def test_readme(self):
21
        rv = self.app.get('/docs/README.md', follow_redirects=True)
22
        self.assertIn('Spike is a simple web application to manage', rv.data)
23
24
    def test_dynamic_doc(self):
25
        rv = self.app.get('/docs/docs.md', follow_redirects=True)
26
        self.assertIn('<h2><a href="/docs">Spike - Docs</a></h2>', rv.data)
27
28
    def test_lfi(self):
29
        rv = self.app.get('/docs/../../../../etc/passwd', follow_redirects=True)
30
        self.assertIn('<h2>Spike - Docs - Overview</h2>', rv.data)
31
        self.assertNotIn('root:x:0:0:root:/root:', rv.data)
32