Passed
Branch master (3ecb90)
by jvo
01:31
created

FlaskrTestCase.test_readme()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
cc 1
dl 0
loc 3
ccs 3
cts 3
cp 1
crap 1
rs 10
1 1
try:
2 1
    from urlparse import urlparse
0 ignored issues
show
Unused Code introduced by
Unused urlparse imported from urlparse
Loading history...
3
except ImportError:  # python3
4
    from urllib.parse import urlparse
5
6 1
from spike import create_app
7 1
from spike.model import db
8 1
import unittest
9
10
11 1
class FlaskrTestCase(unittest.TestCase):
12 1
    def setUp(self):
13 1
        app = create_app()
14 1
        db.init_app(app)
15 1
        app.config['TESTING'] = True
16 1
        self.app = app.test_client()
17
18 1
    def tearDown(self):
19 1
        pass
20
21 1
    def test_index(self):
22 1
        rv = self.app.get('/docs', follow_redirects=True)
23 1
        self.assertIn('<h2>Spike - Docs - Overview</h2>', rv.data)
24
25 1
    def test_readme(self):
26 1
        rv = self.app.get('/docs/README.md', follow_redirects=True)
27 1
        self.assertIn('Spike is a simple web application to manage', rv.data)
28
29 1
    def test_dynamic_doc(self):
30 1
        rv = self.app.get('/docs/docs.md', follow_redirects=True)
31 1
        self.assertIn('<h2><a href="/docs">Spike - Docs</a></h2>', rv.data)
32
33 1
    def test_LFI(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_LFI does not conform to the method naming conventions ([a-z_][a-z0-9_]{1,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
34 1
        rv = self.app.get('/docs/../../../../etc/passwd', follow_redirects=True)
35 1
        self.assertIn('<h2>Spike - Docs - Overview</h2>', rv.data)
36
        self.assertNotIn('root:x:0:0:root:/root:', rv.data)
37