mirror of
https://github.com/d9pouces/id_configurator.git
synced 2026-11-09 01:47:21 +01:00
feat: add --config-url-insecure option to disable TLS certificate verification
Signed-off-by: d9pouces <github@19pouces.net>
This commit is contained in:
@@ -30,6 +30,14 @@ def test_validate_valid_config(tmp_path) -> None:
|
||||
assert "is valid" in result.stdout
|
||||
|
||||
|
||||
def test_validate_without_uuid_or_organisation(tmp_path) -> None:
|
||||
config_path = write_config(tmp_path, {})
|
||||
result = runner.invoke(cli.app, ["validate", "--config", config_path])
|
||||
assert result.exit_code == 0
|
||||
assert "<no uuid>" in result.stdout
|
||||
assert "<no organisation>" in result.stdout
|
||||
|
||||
|
||||
def test_validate_without_config_fails() -> None:
|
||||
result = runner.invoke(cli.app, ["validate"])
|
||||
assert result.exit_code != 0
|
||||
@@ -56,6 +64,24 @@ def test_validate_from_config_url(monkeypatch) -> None:
|
||||
assert "is valid" in result.stdout
|
||||
|
||||
|
||||
def test_validate_from_config_url_insecure(monkeypatch) -> None:
|
||||
mock_urlopen = _mock_urlopen(json.dumps(MINIMAL_CONFIG).encode("utf-8"))
|
||||
monkeypatch.setattr("id_configurator.config.urllib.request.urlopen", mock_urlopen)
|
||||
result = runner.invoke(
|
||||
cli.app,
|
||||
[
|
||||
"validate",
|
||||
"--config-url",
|
||||
"https://example.invalid/config.json",
|
||||
"--config-url-insecure",
|
||||
],
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
assert "is valid" in result.stdout
|
||||
_, kwargs = mock_urlopen.call_args
|
||||
assert kwargs["context"].verify_mode.name == "CERT_NONE"
|
||||
|
||||
|
||||
def test_list_modules() -> None:
|
||||
result = runner.invoke(cli.app, ["list-modules"])
|
||||
assert result.exit_code == 0
|
||||
|
||||
Reference in New Issue
Block a user