mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Add hook for custom jupyterhub_config.py content
This lets extensions directly control how JupyterHub is configured
This commit is contained in:
@@ -35,4 +35,8 @@ def tljh_config_post_install(config):
|
||||
# Put an arbitrary marker we can test for
|
||||
config['simplest_plugin'] = {
|
||||
'present': True
|
||||
}
|
||||
}
|
||||
|
||||
@hookimpl
|
||||
def tljh_custom_jupyterhub_config(c):
|
||||
c.JupyterHub.authenticator_class = 'tmpauthenticator.TmpAuthenticator'
|
||||
@@ -2,6 +2,7 @@
|
||||
Test simplest plugin
|
||||
"""
|
||||
from ruamel.yaml import YAML
|
||||
import requests
|
||||
import os
|
||||
import subprocess
|
||||
from tljh.config import CONFIG_FILE, USER_ENV_PREFIX, HUB_ENV_PREFIX
|
||||
@@ -52,3 +53,11 @@ def test_config_hook():
|
||||
data = yaml.load(f)
|
||||
|
||||
assert data['simplest_plugin']['present']
|
||||
|
||||
def test_jupyterhub_config_hook():
|
||||
"""
|
||||
Test that tmpauthenticator is enabled by our custom config plugin
|
||||
"""
|
||||
resp = requests.get('http://localhost/hub/tmplogin', allow_redirects=False)
|
||||
assert resp.status_code == 302
|
||||
assert resp.headers['Location'] == '/hub/spawn'
|
||||
|
||||
Reference in New Issue
Block a user