blitz_api/conftest.py
fusion44 9912ff0bfa
fix(apps): honour keep_data on uninstall and fix install log name
- uninstall_app dropped input.keep_data; _manage_app always ran the
  bonus script with a bare 'off', so the RaspiBlitz script fell back to
  an interactive whiptail prompt that hangs the non-interactive API.
  Thread keep_data through and pass the explicit
  --keep-data/--delete-data flag the scripts expect.
- install.{app_id}.log rendered as install.AppId.MEMPOOL.log because
  str-enum formatting includes the class name on Python 3.11+; use
  app_id.value here and in the CLN-incompatibility message.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:58:35 +02:00

28 lines
910 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",
# must be an existing directory for the raspiblitz apps impl to import
"BAPI_RB_SHELL_SCRIPT_PATH": "/tmp",
}
for _key, _value in _TEST_ENV_DEFAULTS.items():
os.environ.setdefault(_key, _value)