for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from time import strftime, localtime
try:
from urlparse import urlparse
except ImportError: # python3
from urllib.parse import urlparse
from spike import create_app, seeds
from spike.model import db
import unittest
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
app = create_app('../config.cfg')
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('/rulesets', follow_redirects=False)
rv
[a-z_][a-z0-9_]{2,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.
self.assertEqual(rv.status_code, 301)
self.assertEqual(urlparse(rv.location).path, '/rulesets/')
def test_plain(self):
rv = self.app.get('/rulesets/plain', follow_redirects=False)
rv = self.app.get('/rulesets/plain', follow_redirects=True)
for seed in seeds.rulesets_seeds:
self.assertIn(seed, rv.data)