for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
try:
from urlparse import urlparse
except ImportError: # python3
from urllib.parse import urlparse
from spike import create_app
from spike.model import db
import unittest
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
app = create_app()
db.init_app(app)
app.config['TESTING'] = True
self.app = app.test_client()
def tearDown(self):
pass
def test_index(self):
rv = self.app.get('/docs', follow_redirects=True)
self.assertIn('<h2>Spike - Docs - Overview</h2>', rv.data)
def test_readme(self):
rv = self.app.get('/docs/README.md', follow_redirects=True)
self.assertIn('Spike is a simple web application to manage', rv.data)
def test_dynamic_doc(self):
rv = self.app.get('/docs/docs.md', follow_redirects=True)
self.assertIn('<h2><a href="/docs">Spike - Docs</a></h2>', rv.data)
def test_LFI(self):
test_LFI
[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.
rv = self.app.get('/docs/../../../../etc/passwd', follow_redirects=True)
self.assertNotIn('root:x:0:0:root:/root:', rv.data)