Merge pull request #3773 from IgorBerman/issue-3772-user_options-returns-empty-jupyterhub-restart

Using orm_spawner in server model user_options
This commit is contained in:
Min RK
2022-01-21 09:38:37 +01:00
committed by GitHub
2 changed files with 13 additions and 0 deletions

View File

@@ -81,6 +81,18 @@ async def test_spawner(db, request):
assert isinstance(status, int) assert isinstance(status, int)
def test_spawner_from_db(app, user):
spawner = user.spawners['name']
user_options = {"test": "value"}
spawner.orm_spawner.user_options = user_options
app.db.commit()
# delete and recreate the spawner from the db
user.spawners.pop('name')
new_spawner = user.spawners['name']
assert new_spawner.orm_spawner.user_options == user_options
assert new_spawner.user_options == user_options
async def wait_for_spawner(spawner, timeout=10): async def wait_for_spawner(spawner, timeout=10):
"""Wait for an http server to show up """Wait for an http server to show up

View File

@@ -376,6 +376,7 @@ class User:
oauth_client_id=client_id, oauth_client_id=client_id,
cookie_options=self.settings.get('cookie_options', {}), cookie_options=self.settings.get('cookie_options', {}),
trusted_alt_names=trusted_alt_names, trusted_alt_names=trusted_alt_names,
user_options=orm_spawner.user_options or {},
) )
if self.settings.get('internal_ssl'): if self.settings.get('internal_ssl'):