CI / backend (pull_request) Canceled after 0s
CI / shell (pull_request) Canceled after 0s
CI / frontend (pull_request) Canceled after 0s
CI / arm64-smoke (pull_request) Canceled after 0s
CI / backend (push) Canceled after 0s
CI / shell (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / arm64-smoke (push) Canceled after 0s
26 lines
655 B
Python
26 lines
655 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from tuxdmx_midi_bridge.config import load_config
|
|
|
|
|
|
def test_load_config_prefers_env_token(monkeypatch, tmp_path: Path) -> None:
|
|
config_path = tmp_path / "config.yaml"
|
|
config_path.write_text(
|
|
"""
|
|
bridge_id: bridge-a
|
|
server:
|
|
url: "http://127.0.0.1:8000/api/v1/integrations/midi/bridge"
|
|
api_token: "yaml-token"
|
|
midi:
|
|
device_name: "USB MIDI"
|
|
""".strip(),
|
|
encoding="utf-8",
|
|
)
|
|
monkeypatch.setenv("TUXDMX_API_TOKEN", "env-token")
|
|
config = load_config(config_path)
|
|
assert config.server.api_token == "env-token"
|
|
assert config.bridge_id == "bridge-a"
|
|
|