Esempio n. 1
0
import os
from flask_script import Manager, Shell, Server
from flask_script.commands import Clean, ShowUrls
from flask_migrate import MigrateCommand, Migrate
from flask.ext.sqlalchemy import sqlalchemy

import seed_db
from rank.app import create_app
from rank.settings import DevConfig, ProdConfig
from rank.core.models import Base, DB

DEFAULT_DB = 'postgres'
CREATE_DB = 'create database %s'

if os.environ.get("RANK_ENV") == 'prod':
    application = create_app(ProdConfig)
else:
    application = create_app(DevConfig)

HERE = os.path.abspath(os.path.dirname(__file__))
TEST_PATH = os.path.join(HERE, 'tests')

migrate = Migrate(application, Base)
manager = Manager(application)


def _make_context():
    """Return context dict for a shell session so you can access
    app, db, and the User model by default.
    """
    return {'app': application, 'db': DB}
Esempio n. 2
0
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
Esempio n. 3
0
 def create_app(self):
     app = create_app(config_object=TestConfig)
     return app
Esempio n. 4
0
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