Exemplo n.º 1
0
def app():
    """ an application for the tests """
    _app = create_app(TestConfig)
    with _app.app_context():
        _db.create_all()

    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
Exemplo n.º 2
0
def test_production_confing():
    app = create_app(ProdConfig)
    assert app.config['ENV'] == 'prod'
    assert not app.config['DEBUG']
Exemplo n.º 3
0
                                   encoding=None,
                                   delay=False,
                                   utc=True,
                                   atTime=None)

formatter = logging.Formatter(CONFIG.LOG_FORMAT)

handler.setLevel(CONFIG.LOG_LEVEL)
handler.setFormatter(formatter)

# logging.basicConfig(filename=CONFIG.LOG_FILE,
#                     format=CONFIG.LOG_FORMAT,
#                     level=CONFIG.LOG_LEVEL)

if CONFIG.SQLALCHEMY_DATABASE_URI is None:
    raise Exception("DATABASE_URI no set")

app = create_app(CONFIG)
# with app.app_context():
#    try:
#        db.session.query(DonateConfiguration).filter_by(key="INIT").one()
#    except NoResultFound:
#        raise ValueError("Donate is not initialized")

app.before_request(start_timer)
app.after_request(log_request)

app.logger.addHandler(handler)
app.logger.info("App initialized")
app.secret_key = os.environ['DONATE_SECRET']
Exemplo n.º 4
0
def test_dev_config():
    app = create_app(DevConfig)
    assert app.config['ENV'] == 'dev'
    assert app.config['DEBUG']