예제 #1
0
def app():
    db_fd, database = tempfile.mkstemp()
    app = create_app({
        'DATABASE': database,
        'TESTING': True,
        'SECRET_KEY': 'test',
    })

    with app.app_context():
        init_db()
        get_db().executescript(test_data_sql())

    yield app

    os.close(db_fd)
    os.unlink(app.config['DATABASE'])
예제 #2
0
def app():
    app = create_app({
        'TESTING': True,
        'DB_NAME': 'flask_boilerplate_test',
        'DB_USER': '******',
    })

    with app.app_context():
        # Create the database in a blank state
        init_db()

        # Fill the database with mock data for tests
        data_file = os.path.join(os.path.dirname(__file__), 'data.sql')
        with open(data_file, 'rb') as f:
            with get_db() as con:
                with con.cursor() as cur:
                    cur.execute(f.read())

    yield app
예제 #3
0
def test_config():
    assert not create_app().testing
    assert create_app({'TESTING': True}).testing
예제 #4
0
def app():
    app = create_app({
        'TESTING': True,
    })

    yield app
예제 #5
0
def test_not_passing_test_config():
    app = create_app()
    assert app.testing is False
예제 #6
0
from flask_boilerplate import create_app

app = create_app()
예제 #7
0
# -*- coding: utf-8 -*- 
import os
from flask_boilerplate import create_app

app = create_app()

if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0',port=port,debug=True)