feat(apim-apps): first commit

This commit is contained in:
2026-06-29 14:22:37 +02:00
commit 7738a51d16
28 changed files with 1973 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import json
import pytest
from apim_apps import load_config
SAMPLE = {
"environments": [
{"name": "DEV_LAN", "url": "https://dev.example.com:8075", "verify_ssl": False},
{"name": "PROD", "url": "https://prod.example.com:8075", "verify_ssl": True},
]
}
def test_load_config_names_and_urls(tmp_path):
f = tmp_path / "config.json"
f.write_text(json.dumps(SAMPLE))
envs = load_config(str(f))
assert len(envs) == 2
assert envs[0].name == "DEV_LAN"
assert envs[0].url == "https://dev.example.com:8075"
assert envs[0].verify_ssl is False
assert envs[1].name == "PROD"
assert envs[1].verify_ssl is True
def test_credentials_not_loaded_from_config(tmp_path):
"""Credentials come from env vars, not from config.json."""
f = tmp_path / "config.json"
f.write_text(json.dumps(SAMPLE))
envs = load_config(str(f))
for env in envs:
assert env.username == ""
assert env.password == ""
def test_verify_ssl_defaults_to_false(tmp_path):
config = {"environments": [{"name": "DEV", "url": "https://dev.example.com:8075"}]}
f = tmp_path / "config.json"
f.write_text(json.dumps(config))
envs = load_config(str(f))
assert envs[0].verify_ssl is False