def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_context() self.app_context.push() # db.engine.connect().connection.connection.text_factory = str db.create_all() self.client = self.app.test_client(use_cookies=True)
def create_app(self): return create_app('testing')
from flask.ext.script import Manager, Shell from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.script.commands import ShowUrls from sqlalchemy.exc import IntegrityError from suda import create_app, db from suda.models import Client COV = None if os.environ.get('FLASK_COVERAGE'): import coverage COV = coverage.coverage(branch=True, include='suda/*') COV.start() app = create_app(os.getenv('FLASK_CONFIG') or 'development') manager = Manager(app) migrate = Migrate(app, db) def make_shell_context(): return dict(app=app, db=db) @manager.command def test(coverage=False): """Run the unit test.""" if coverage and not os.environ.get('FLASK_COVERAGE'): import sys