mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Fixed some issues
This commit is contained in:
@@ -119,16 +119,19 @@ def test_remove_from_config_error():
|
||||
def test_reload_hub():
|
||||
with mock.patch('tljh.systemd.restart_service') as restart_service, mock.patch(
|
||||
'tljh.systemd.check_service_active'
|
||||
) as check_active, mock.patch('tljh.systemd.check_hub_ready') as check_ready:
|
||||
) as check_active, mock.patch('tljh.config.check_hub_ready') as check_ready:
|
||||
config.reload_component('hub')
|
||||
assert restart_service.called_with('jupyterhub')
|
||||
assert check_active.called_with('jupyterhub')
|
||||
|
||||
|
||||
def test_reload_proxy(tljh_dir):
|
||||
with mock.patch('tljh.systemd.restart_service') as restart_service:
|
||||
with mock.patch('tljh.systemd.restart_service') as restart_service, mock.patch(
|
||||
'tljh.systemd.check_service_active'
|
||||
) as check_active:
|
||||
config.reload_component('proxy')
|
||||
assert restart_service.called_with('traefik')
|
||||
assert check_active.called_with('traefik')
|
||||
assert os.path.exists(os.path.join(config.STATE_DIR, 'traefik.toml'))
|
||||
|
||||
|
||||
|
||||
@@ -159,3 +159,27 @@ def test_auth_github():
|
||||
assert c.JupyterHub.authenticator_class == 'oauthenticator.github.GitHubOAuthenticator'
|
||||
assert c.GitHubOAuthenticator.client_id == 'something'
|
||||
assert c.GitHubOAuthenticator.client_secret == 'something-else'
|
||||
|
||||
|
||||
def test_auth_api_default():
|
||||
"""
|
||||
Test default traefik api authentication settings with no overrides
|
||||
"""
|
||||
c = apply_mock_config({})
|
||||
|
||||
assert c.TraefikTomlProxy.traefik_api_username == 'api_admin'
|
||||
assert c.TraefikTomlProxy.traefik_api_password == 'admin'
|
||||
|
||||
|
||||
def test_set_auth_api():
|
||||
"""
|
||||
Test setting per traefik api credentials
|
||||
"""
|
||||
c = apply_mock_config({
|
||||
'auth_api': {
|
||||
'username': 'some_user',
|
||||
'password': '1234'
|
||||
}
|
||||
})
|
||||
assert c.TraefikTomlProxy.traefik_api_username == 'some_user'
|
||||
assert c.TraefikTomlProxy.traefik_api_password == '1234'
|
||||
Reference in New Issue
Block a user