Example #1
0
def app_for_testing():
    from osmpoint.application import create_app

    tmp_dir = py.path.local.mkdtemp()
    config_for_tests = ("OSM_API = 'api06.dev.openstreetmap.org'\n"
                        "SECRET_KEY = 'my-secret-key'\n"
                        "SQLALCHEMY_DATABASE_URI = 'sqlite:///%s/db.sqlite'\n"
                        "MAIL_SERVER = 'my_mailhost'\n"
                        "MAIL_FROM = '*****@*****.**'\n"
                        "MAIL_ADMIN = '*****@*****.**'\n"
                        "IMPORTED_POINTS_PATH = '.'\n") % tmp_dir
    tmp_dir.join('config.py').write(config_for_tests)
    cleanup = tmp_dir.remove

    app = create_app(str(tmp_dir))

    return app, cleanup
Example #2
0
def _app_for_testing(addCleanup):
    from osmpoint.application import create_app

    tmp_dir = py.path.local.mkdtemp()
    from redis_tests import set_up_redis
    redis_socket_path = set_up_redis(tmp_dir, addCleanup)
    config_for_tests = ("OSM_API = 'api06.dev.openstreetmap.org'\n"
                        "SECRET_KEY = 'my-secret-key'\n"
                        "SQLALCHEMY_DATABASE_URI = 'sqlite:///%s/db.sqlite'\n"
                        "MAIL_SERVER = 'my_mailhost'\n"
                        "MAIL_FROM = '*****@*****.**'\n"
                        "MAIL_ADMIN = '*****@*****.**'\n"
                        "IMPORTED_POINTS_PATH = '.'\n"
                        "REDIS_SOCKET_PATH = '%s'\n"
                       ) % (tmp_dir, redis_socket_path)
    tmp_dir.join('config.py').write(config_for_tests)
    addCleanup(tmp_dir.remove)

    app = create_app(str(tmp_dir))
    app.try_trigger_before_first_request_functions()
    return app