Files
TieMeasureFlow/client/tests/test_config_station.py
T
Adriano 958f6ac0b0 feat(client): add STATION_CODE env var and config attribute
Reads STATION_CODE from the environment and exposes it as Config.STATION_CODE
(None when unset or empty). Adds the variable to .env.example with a
per-station deployment note, and covers both read and missing-key paths with
new pytest tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 23:18:24 +02:00

18 lines
531 B
Python

"""Tests that STATION_CODE is loaded from env and exposed on the client Config class."""
import importlib
import os
def test_station_code_read_from_env(monkeypatch):
monkeypatch.setenv("STATION_CODE", "ST-TEST")
import config
importlib.reload(config)
assert config.Config.STATION_CODE == "ST-TEST"
def test_station_code_defaults_to_none_when_missing(monkeypatch):
monkeypatch.delenv("STATION_CODE", raising=False)
import config
importlib.reload(config)
assert config.Config.STATION_CODE is None