def init(dest): from neorg.web import app, init_db from neorg.config import init_config_file, load_config init_config_file(dest) load_config(app, dest) init_db()
def setup_app(): web.app.config.from_object(DefaultConfig) (db_fd, web.app.config['DATABASE']) = tempfile.mkstemp(prefix=TMP_PREFIX) dirpath = tempfile.mkdtemp(prefix=TMP_PREFIX) # = NEORG_ROOT set_config(web.app.config, dirpath) os.mkdir(web.app.config['NEORG_DIR']) web.app.config['SECRET_KEY'] = 'key for testing' app = web.app.test_client() web.init_db() web.update_search_index() from neorg.wiki import setup_wiki, gene_html setup_wiki() def gene_html_with_encode(*args, **kwds): return gene_html(*args, **kwds).encode('utf-8') return (app, db_fd, gene_html_with_encode)