def app(request): """Basic Flask application.""" instance_path = tempfile.mkdtemp() app = Flask("testapp") DB = os.getenv("SQLALCHEMY_DATABASE_URI", "sqlite://") app.config.update( I18N_LANGUAGES=[("en", "English"), ("de", "German")], SQLALCHEMY_DATABASE_URI=DB, SQLALCHEMY_TRACK_MODIFICATIONS=False, ) Babel(app) InvenioDB(app) InvenioSearch(app) InvenioThemeTugraz(app) InvenioI18N(app) with app.app_context(): db_url = str(db.engine.url) if db_url != "sqlite://" and not database_exists(db_url): create_database(db_url) db.create_all() def teardown(): with app.app_context(): db_url = str(db.engine.url) db.session.close() if db_url != "sqlite://": drop_database(db_url) shutil.rmtree(instance_path) request.addfinalizer(teardown) app.test_request_context().push() return app
def app(request): """Basic Flask application.""" app = Flask("testapp") app.config.update(I18N_LANGUAGES=[("en", "English"), ("de", "German")], ) InvenioThemeTugraz(app) InvenioI18N(app) return app
def test_init(): """Test extension initialization.""" app = Flask("testapp") ext = InvenioThemeTugraz(app) assert "invenio-theme-tugraz" in app.extensions app = Flask("testapp") ext = InvenioThemeTugraz() assert "invenio-theme-tugraz" not in app.extensions ext.init_app(app) assert "invenio-theme-tugraz" in app.extensions
def test_app(app): """Test extension initialization.""" _ = InvenioThemeTugraz(app)