Exemplo n.º 1
0
def app(request):
    """Flask application fixture."""
    app_ = Flask('testapp')
    app_.config.update(
        TESTING=True,
        CELERY_ALWAYS_EAGER=True,
        CELERY_CACHE_BACKEND="memory",
        CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
        CELERY_RESULT_BACKEND="cache",
        SQLALCHEMY_DATABASE_URI=os.environ.get('SQLALCHEMY_DATABASE_URI',
                                               'sqlite://'),
        SQLALCHEMY_TRACK_MODIFICATIONS=False,
        SECRET_KEY='mysecret',
        SUPPORT_EMAIL='*****@*****.**',
        WTF_CSRF_ENABLED=False,
        SERVER_NAME='test.it',
        RECORDS_UI_ENDPOINTS=dict(
            recid=dict(
                pid_type='recid',
                route='/records/<pid_value>',
                template='invenio_records_ui/detail.html',
            ),
            recid_access_request=dict(
                pid_type='recid',
                route='/records/<pid_value>/accessrequest',
                template='zenodo_accessrequests/access_request.html',
                view_imp='zenodo_accessrequests.views.requests.access_request',
                methods=['GET', 'POST'],
            ),
            recid_access_request_email_confirm=dict(
                pid_type='recid',
                route='/records/<pid_value>/accessrequest/<token>/confirm',
                #  template='invenio_records_ui/detail.html',
                view_imp='zenodo_accessrequests.views.requests.confirm',
            ),
        ),
    )

    InvenioFormatter(app_)
    Babel(app_)
    InvenioDB(app_)
    InvenioAccounts(app_)
    InvenioRecords(app_)
    FlaskMenu(app_)
    Mail(app_)
    InvenioRecordsUI(app_)
    InvenioAccess(app_)
    ZenodoAccessRequests(app_)
    InvenioPIDStore(app_)

    app_.register_blueprint(request_blueprint)
    app_.register_blueprint(settings_blueprint)
    app_.register_blueprint(blueprint_user)
    app_.register_blueprint(create_blueprint_from_app(app_))

    with app_.app_context():
        yield app_
Exemplo n.º 2
0
    SQLALCHEMY_DATABASE_URI=os.environ.get('SQLALCHEMY_DATABASE_URI',
                                           'sqlite:///orcid_app_rest.db'),
    OAUTHCLIENT_REST_REMOTE_APPS=dict(orcid=orcid.REMOTE_SANDBOX_REST_APP, ),
    ORCID_APP_CREDENTIALS=ORCID_APP_CREDENTIALS,
    DEBUG=True,
    SECRET_KEY='TEST',
    SECURITY_PASSWORD_SALT='security-password-salt',
    SECURITY_LOGIN_WITHOUT_CONFIRMATION=False,
    USERPROFILES_EXTEND_SECURITY_FORMS=True,
    SQLALCHEMY_TRACK_MODIFICATIONS=False,
    APP_THEME=['semantic-ui'],
    THEME_ICONS={'semantic-ui': dict(link='linkify icon')})

Babel(app)
FlaskMenu(app)
Mail(app)
InvenioDB(app)
InvenioAccounts(app)
InvenioUserProfiles(app)
FlaskOAuth(app)
InvenioOAuthClientREST(app)

app.register_blueprint(blueprint_user)
app.register_blueprint(blueprint_client)
app.register_blueprint(blueprint_userprofile_api_init)
app.register_blueprint(blueprint_userprofile_ui_init)


@app.route('/')
def index():
    """Homepage."""