958f6ac0b0
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>
18 lines
531 B
Python
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
|