test: add integration test for config flow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-18 14:01:46 +08:00
parent ec5dda61ef
commit ddc175edc3

View File

@@ -81,3 +81,25 @@ def test_get_default_config_path():
assert path.name == "config.toml"
assert ".config" in str(path)
assert "zzpyjenkins" in str(path)
def test_full_config_flow():
"""Test complete config loading flow with temp file."""
with tempfile.NamedTemporaryFile(mode="w", suffix=".toml", delete=False) as f:
f.write("""
[work]
url = "https://jenkins.example.com"
username = "testuser"
password = "testpass"
""")
temp_path = Path(f.name)
try:
config = load_config(temp_path)
url, username, password = get_server_config(config, "work")
assert url == "https://jenkins.example.com"
assert username == "testuser"
assert password == "testpass"
finally:
temp_path.unlink()