Exemplo n.º 1
0
def test_false_docker_image(monkeypatch):
    from config import TestingConfig
    monkeypatch.setattr(TestingConfig, 'ENABLED_ROUTERS',
                        ['valhalla', 'graphhopper'])
    monkeypatch.setattr(TestingConfig, 'GRAPHHOPPER_IMAGE', '')
    with pytest.raises(NullResource):
        create_app('testing')
Exemplo n.º 2
0
def test_create_app_with_broken_import_config(monkeypatch):
    CONF_MAPPER['broken-import-config'] = 'broken-import-config'
    if os.getenv('FLASK_CONFIG'):
        monkeypatch.delenv('FLASK_CONFIG')
    with pytest.raises(ImportError):
        create_app('broken-import-config')
    del CONF_MAPPER['broken-import-config']
Exemplo n.º 3
0
def test_create_app_empty_config(monkeypatch):
    """Remove FLASK_CONFIG=testing"""
    if os.getenv('FLASK_CONFIG'):
        monkeypatch.delenv('FLASK_CONFIG')

    with pytest.raises(KeyError):
        create_app(config_string=None)
Exemplo n.º 4
0
def test_create_app_passing_flask_config_name(monkeypatch, flask_config_name):
    if flask_config_name != 'testing':
        from config import ProdConfig, DevConfig
        new_data_dir = os.path.join(
            os.path.dirname(os.path.realpath(__file__)), "data")
        for c in (ProdConfig, DevConfig):
            monkeypatch.setattr(c, 'DATA_DIR', new_data_dir)
            monkeypatch.setattr(c, 'ENABLED_PROVIDERS',
                                ["osm", "tomtom", "here"])
    create_app(config_string=flask_config_name)
Exemplo n.º 5
0
def flask_app():
    app = create_app(config_string='testing')
    from routing_packager_app import db
    with app.app_context():
        db.create_all()
        yield app
        db.session.close()
        db.drop_all()
Exemplo n.º 6
0
def test_create_app():
    create_app('testing')
Exemplo n.º 7
0
from routing_packager_app import create_app, cli, db
from routing_packager_app.api_v1 import User, Job

app = create_app()
cli.register(app)


@app.shell_context_processor
def make_shell_context():
    return {'db': db, 'User': User, 'Job': Job}