init default oauth client in init_db

ensures jupyterhub client is present,
which is required for creation of tokens, etc.
This commit is contained in:
Min RK
2021-04-13 13:32:16 +02:00
parent d85c316928
commit c8821b7700
2 changed files with 25 additions and 26 deletions

View File

@@ -125,16 +125,14 @@ def db():
"""Get a db session"""
global _db
if _db is None:
_db = orm.new_session_factory('sqlite:///:memory:')()
# make sure some initial db contents are filled out
# specifically, the 'default' jupyterhub oauth client
app = MockHub(db_url='sqlite:///:memory:')
app.init_db()
_db = app.db
user = orm.User(name=getuser())
_db.add(user)
_db.commit()
# make sure some initial db contents are filled out
# specifically, the 'default' jupyterhub oauth client
app = MockHub()
app.db = _db
app.init_hub()
app.init_oauth()
return _db