예제 #1
0
def app(instance_path, config):
    """Flask application fixture."""
    app = Flask('testapp', instance_path=instance_path)
    app.config.update(config)
    InvenioDB(app)
    InvenioAccounts(app)
    InvenioJSONSchemas(app)
    InvenioSIPStore(app)

    with app.app_context():
        yield app
예제 #2
0
def base_app(instance_path):
    """Flask application fixture."""
    app = Flask('testapp', instance_path=instance_path)
    app.config.update(
        TESTING=True,
        SECRET_KEY='CHANGE_ME',
        SECURITY_PASSWORD_SALT='CHANGE_ME',
        SQLALCHEMY_DATABASE_URI=os.environ.get('SQLALCHEMY_DATABASE_URI',
                                               'sqlite:///test.db'),
    )
    InvenioSIPStore(app)
    return app
예제 #3
0
def app(base_app):
    """Flask full application fixture."""
    Breadcrumbs(base_app)
    InvenioDB(base_app)
    InvenioAccess(base_app)
    InvenioAccounts(base_app)
    InvenioFilesREST(base_app)
    InvenioOAuth2Server(base_app)
    InvenioOAuth2ServerREST(base_app)
    InvenioREST(base_app)
    InvenioSIPStore(base_app)
    base_app.register_blueprint(server_blueprint)
    base_app.register_blueprint(blueprint)
    with base_app.app_context():
        yield base_app
예제 #4
0
def test_init():
    """Test extension initialization."""
    app = Flask('testapp')
    ext = InvenioSIPStore(app)
    assert 'invenio-sipstore' in app.extensions

    app = Flask('testapp')
    ext = InvenioSIPStore()
    assert 'invenio-sipstore' not in app.extensions
    ext.init_app(app)
    assert 'invenio-sipstore' in app.extensions
예제 #5
0
from invenio_archivematica import InvenioArchivematica
from invenio_archivematica.views.ui import blueprint

# Create Flask application
app = Flask(__name__)
app.config.update(dict(
    BROKER_URL='redis://',
    CELERY_RESULT_BACKEND='redis://',
    REST_ENABLE_CORS=True,
    SECRET_KEY='CHANGEME',
    SIPSTORE_AGENT_JSONSCHEMA_ENABLED=False,
    SQLALCHEMY_ECHO=False,
    SQLALCHEMY_DATABASE_URI=os.environ.get(
        'SQLALCHEMY_DATABASE_URI', 'sqlite:///test.db'
    ),
    SQLALCHEMY_TRACK_MODIFICATIONS=True,
))

Babel(app)
InvenioAccess(app)
InvenioAccounts(app)
InvenioArchivematica(app)
InvenioDB(app)
InvenioFilesREST(app)
InvenioPIDStore(app)
InvenioREST(app)
InvenioSIPStore(app)

app.register_blueprint(blueprint)