Пример #1
0
def test_config(monkeypatch):
    # Default config
    assert not create_app().testing

    # Test config
    assert create_app({'TESTING': True}).testing

    # Prod config
    monkeypatch.setenv('DATABASE_URL', "pretend this is on heroku...")
    assert "heroku" in create_app().config['DB_URL']
    assert "require" in create_app().config['DB_SSLMODE']
Пример #2
0
def app():
    """Create an app configured for tests."""

    app = create_app({
        'TESTING': True,
        'DB_URL': "postgresql://flasktodo_user@localhost/flasktodo_test"
    })

    # Using app context, create database tables and fill with mock data
    with app.app_context():
        db.init_db()
        db.mock_db()

    yield app
Пример #3
0
from flasktodo import create_app

app = create_app()