mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Fixed cfg runtime entry in test
This commit is contained in:
@@ -2,3 +2,4 @@ pytest
|
||||
pytest-cov
|
||||
codecov
|
||||
pytoml
|
||||
passlib
|
||||
|
||||
@@ -27,13 +27,19 @@ def test_default_config(tmpdir, tljh_dir):
|
||||
print(toml_cfg)
|
||||
cfg = toml.loads(toml_cfg)
|
||||
assert cfg["defaultEntryPoints"] == ["http"]
|
||||
assert len(cfg["entryPoints"]["auth_api"]["auth"]["basic"]["users"]) == 1
|
||||
assert cfg["entryPoints"]["auth_api"]["auth"]["basic"]["users"][0].startswith("api_admin")
|
||||
# runtime generated entry, value not testable
|
||||
cfg["entryPoints"]["auth_api"]["auth"]["basic"]["users"] = [""]
|
||||
|
||||
assert cfg["entryPoints"] == {
|
||||
"http": {"address": ":80"},
|
||||
"auth_api": {
|
||||
"address": ":8099",
|
||||
"auth": {
|
||||
"basic": {"users": ["api_admin:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./"]}
|
||||
"basic": {"users": [""]}
|
||||
},
|
||||
"whiteList": {"sourceRange": ["127.0.0.1"]}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -57,14 +63,20 @@ def test_letsencrypt_config(tljh_dir):
|
||||
cfg = toml.loads(toml_cfg)
|
||||
assert cfg["defaultEntryPoints"] == ["http", "https"]
|
||||
assert "acme" in cfg
|
||||
assert len(cfg["entryPoints"]["auth_api"]["auth"]["basic"]["users"]) == 1
|
||||
assert cfg["entryPoints"]["auth_api"]["auth"]["basic"]["users"][0].startswith("api_admin")
|
||||
# runtime generated entry, value not testable
|
||||
cfg["entryPoints"]["auth_api"]["auth"]["basic"]["users"] = [""]
|
||||
|
||||
assert cfg["entryPoints"] == {
|
||||
"http": {"address": ":80", "redirect": {"entryPoint": "https"}},
|
||||
"https": {"address": ":443", "tls": {}},
|
||||
"auth_api": {
|
||||
"address": ":8099",
|
||||
"auth": {
|
||||
"basic": {"users": ["api_admin:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./"]}
|
||||
"basic": {"users": [""]}
|
||||
},
|
||||
"whiteList": {"sourceRange": ["127.0.0.1"]}
|
||||
},
|
||||
}
|
||||
assert cfg["acme"] == {
|
||||
@@ -91,6 +103,10 @@ def test_manual_ssl_config(tljh_dir):
|
||||
cfg = toml.loads(toml_cfg)
|
||||
assert cfg["defaultEntryPoints"] == ["http", "https"]
|
||||
assert "acme" not in cfg
|
||||
assert len(cfg["entryPoints"]["auth_api"]["auth"]["basic"]["users"]) == 1
|
||||
assert cfg["entryPoints"]["auth_api"]["auth"]["basic"]["users"][0].startswith("api_admin")
|
||||
# runtime generated entry, value not testable
|
||||
cfg["entryPoints"]["auth_api"]["auth"]["basic"]["users"] = [""]
|
||||
assert cfg["entryPoints"] == {
|
||||
"http": {"address": ":80", "redirect": {"entryPoint": "https"}},
|
||||
"https": {
|
||||
@@ -104,7 +120,8 @@ def test_manual_ssl_config(tljh_dir):
|
||||
"auth_api": {
|
||||
"address": ":8099",
|
||||
"auth": {
|
||||
"basic": {"users": ["api_admin:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./"]}
|
||||
"basic": {"users": [""]}
|
||||
},
|
||||
"whiteList": {"sourceRange": ["127.0.0.1"]}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user