mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
no longer need to mock out generate_traefik_api_credentials
This commit is contained in:
@@ -128,9 +128,7 @@ def test_reload_hub():
|
||||
def test_reload_proxy(tljh_dir):
|
||||
with mock.patch("tljh.systemd.restart_service") as restart_service, mock.patch(
|
||||
"tljh.systemd.check_service_active"
|
||||
) as check_active, mock.patch(
|
||||
"tljh.configurer.generate_traefik_api_credentials"
|
||||
) as generate_credentials:
|
||||
) as check_active:
|
||||
config.reload_component('proxy')
|
||||
assert restart_service.called_with('traefik')
|
||||
assert check_active.called_with('traefik')
|
||||
@@ -153,44 +151,29 @@ def test_cli_no_command(capsys):
|
||||
)
|
||||
def test_cli_set_bool(tljh_dir, arg, value):
|
||||
config.main(["set", "https.enabled", arg])
|
||||
with mock.patch(
|
||||
"tljh.configurer.generate_traefik_api_credentials"
|
||||
) as generate_credentials:
|
||||
cfg = configurer.load_config()
|
||||
cfg = configurer.load_config()
|
||||
assert cfg['https']['enabled'] == value
|
||||
|
||||
|
||||
def test_cli_set_int(tljh_dir):
|
||||
config.main(["set", "https.port", "123"])
|
||||
with mock.patch(
|
||||
"tljh.configurer.generate_traefik_api_credentials"
|
||||
) as generate_credentials:
|
||||
cfg = configurer.load_config()
|
||||
cfg = configurer.load_config()
|
||||
assert cfg['https']['port'] == 123
|
||||
|
||||
|
||||
def test_cli_add_float(tljh_dir):
|
||||
config.main(["add-item", "foo.bar", "1.25"])
|
||||
with mock.patch(
|
||||
"tljh.configurer.generate_traefik_api_credentials"
|
||||
) as generate_credentials:
|
||||
cfg = configurer.load_config()
|
||||
cfg = configurer.load_config()
|
||||
assert cfg['foo']['bar'] == [1.25]
|
||||
|
||||
|
||||
def test_cli_remove_int(tljh_dir):
|
||||
config.main(["add-item", "foo.bar", "1"])
|
||||
config.main(["add-item", "foo.bar", "2"])
|
||||
with mock.patch(
|
||||
"tljh.configurer.generate_traefik_api_credentials"
|
||||
) as generate_credentials:
|
||||
cfg = configurer.load_config()
|
||||
cfg = configurer.load_config()
|
||||
assert cfg['foo']['bar'] == [1, 2]
|
||||
config.main(["remove-item", "foo.bar", "1"])
|
||||
with mock.patch(
|
||||
"tljh.configurer.generate_traefik_api_credentials"
|
||||
) as generate_credentials:
|
||||
cfg = configurer.load_config()
|
||||
cfg = configurer.load_config()
|
||||
assert cfg['foo']['bar'] == [2]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user