def test_prod_config(self): """ Tests if the production config loads correctly """ app = create_app('calc.settings.ProdConfig', env='prod') assert app.config[ 'SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../ascentio-prod.db'
def test_test_config(self): """ Tests if the test config loads correctly """ app = create_app('calc.settings.TestConfig', env='dev') assert app.config['DEBUG'] is True assert app.config['SQLALCHEMY_ECHO'] is True
def test_dev_config(self): """ Tests if the development config loads correctly """ app = create_app('calc.settings.DevConfig', env='dev') assert app.config['DEBUG'] is True assert app.config[ 'SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../ascentio-dev.db'
def testapp(request): app = create_app('calc.settings.TestConfig', env='dev') client = app.test_client() db.app = app db.create_all() def teardown(): db.session.remove() db.drop_all() request.addfinalizer(teardown) return client
import os from flask.ext.script import Manager, Server from flask.ext.script.commands import ShowUrls, Clean from calc import create_app from calc.models import db # default to dev config because no one should use this in # production anyway env = os.environ.get('APPNAME_ENV', 'dev') app = create_app('calc.settings.%sConfig' % env.capitalize(), env=env) manager = Manager(app) manager.add_command("server", Server()) manager.add_command("show-urls", ShowUrls()) manager.add_command("clean", Clean()) @manager.shell def make_shell_context(): """ Creates a python REPL with several default imports in the context of the app """ return dict(app=app, db=db) @manager.command def createdb(): """ Creates a database with all of the tables defined in your SQLAlchemy models