def create_app(self):
     config = Config()
     app = create_app(config)
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     test_client = app.test_client()
     app.post = test_client.post
     app.get = test_client.get
     return app
示例#2
0
 def create_app(self):
     config = Config()
     app = create_app(config)
     app.config["TESTING"] = True
     app.config["WTF_CSRF_ENABLED"] = False
     test_client = app.test_client()
     app.post = test_client.post
     app.get = test_client.get
     return app
示例#3
0
 def create_app(self):
     config = Config()
     app = create_app(config)
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.wsgi_app = LocalhostProxyHack(app.wsgi_app)
     test_client = app.test_client()
     app.post = test_client.post
     app.get = test_client.get
     return app
示例#4
0
#!/usr/bin/env python3

from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand

from flask_truss.factory import create_app
from flask_truss.conf.app import Config
from flask_truss. async .base import celery_instance
from flask_truss.models.base import db

config = Config()
app = create_app(config)
manager = Manager(app)
migrate = Migrate(app, db)


@manager.shell
def make_shell_context():
    """IPython session with app loaded"""
    return dict(app=app)


@manager.command
def runserver():
    """Run the Flask development server with the config's settings"""
    app.run(host=config.HOST,
            port=config.PORT,
            debug=config.DEBUG,
            threaded=config.THREADED)

示例#5
0
from flask.ext.script import Manager

from flask_truss.factory import create_app
from flask_truss.conf.app import Config
from flask_truss.async.base import celery_instance

config = Config()
app = create_app(config)
manager = Manager(app)


def make_shell_context():
    return dict(app=app)


@manager.shell
def make_shell_context():
    """IPython session with app loaded"""
    return dict(app=app)


@manager.option(
    "-n",
    "--nose_arguments",
    dest="nose_arguments",
    required=False,
    help="List of arguments to pass to nose. First argument MUST be ''",
    default=["", "--with-coverage", "--cover-package=flask_truss"],
)
def test(nose_arguments):
    """Run nosetests with the given arguments and report coverage"""