blitz_api/conftest.py
fusion44 49d5fcb9bf
fix: send bitcoin-only warmup app status as app_state_update_message
The WebUI only listens for the app_state_update_message SSE event to
populate the Apps tab. In bitcoin-only mode the warmup data was sent
under installed_app_status, which no client listens to, so the Apps
tab was stuck on the loading screen whenever the app status cache was
warm. Installing LND made it work again because the lightning warmup
path already used the correct event (raspiblitz#3608, raspiblitz#5141).

Also hardens the warmup path:
- reset the warmup_running flag on errors so a single failure no
  longer starves all future SSE clients of warmup data
- convert per-source exceptions in the bitcoin-only warmup gather
  instead of discarding the whole data set
- don't fall through to the partial-data branches when the API is
  fully initialized with lightning disabled
- remove the now-unused INSTALLED_APP_STATUS event and the dead
  cached_status_raw variable

Adds regression tests plus a conftest.py providing test env defaults
so the suite runs without a developer .env file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 15:30:17 +02:00

26 lines
794 B
Python

"""
Test environment defaults.
The application reads its configuration via python-decouple at import time,
so these variables must be set before any `app.*` module is imported.
Real environment variables take precedence (os.environ.setdefault).
"""
import os
_TEST_ENV_DEFAULTS = {
"BAPI_PLATFORM": "native_python",
"BAPI_LN_NODE": "lnd_grpc",
"BAPI_JWT_SECRET": "test_secret",
"BAPI_JWT_ALGORITHM": "HS256",
"BAPI_NETWORK": "regtest",
"BAPI_BITCOIND_ADDRESS": "127.0.0.1",
"BAPI_BITCOIND_PORT_RPC": "18443",
"BAPI_BITCOIND_USER": "test",
"BAPI_BITCOIND_RPC_PW": "test",
"BAPI_BITCOIND_ZMQ_BLOCK_RPC": "hashblock",
"BAPI_BITCOIND_ZMQ_BLOCK_PORT": "28332",
}
for _key, _value in _TEST_ENV_DEFAULTS.items():
os.environ.setdefault(_key, _value)