def app(): _app = create_app(TestConfig) ctx = _app.test_request_context() ctx.push() yield _app ctx.pop()
def test_production_config(): app = create_app(ProdConfig) assert app.config['ENV'] == 'prod' assert app.config['DEBUG'] is False assert app.config['DEBUG_TB_ENABLED'] is False assert app.config['ASSETS_DEBUG'] is False
def test_dev_config(): app = create_app(DevConfig) assert app.config['ENV'] == 'dev' assert app.config['DEBUG'] is True assert app.config['ASSETS_DEBUG'] is True
# -*- coding: utf-8 -*- import os import sys from flask_script import (Manager, Shell, Server, prompt, prompt_bool, prompt_pass) from flask_script.commands import Clean, ShowUrls from flask_migrate import MigrateCommand, Migrate from flask import url_for from xenith.app import create_app from xenith.user.models import User from xenith.settings import DevConfig, ProdConfig from xenith.database import db if os.environ.get("XENITH_ENV") == 'prod': app = create_app(ProdConfig) else: app = create_app(DevConfig) manager = Manager(app) migrate = Migrate(app, db) TEST_CMD = "py.test tests" def _make_context(): """Return context dict for a shell session so you can access app, db, and the User model by default. """ return {'app': app, 'db': db, 'User': User}