SWS-12500-custom-component/tests
SchiZzA 5e4b02fd6e
fix: address remaining review findings across forwarders and utils
Forwarders (Windy / Pocasi):
- `enabled` becomes a property reading the option live. Toggling it does not
  reload the entry, so the cached copy left the diagnostics sensor reporting a
  stale value indefinitely for a disabled forwarder.
- Reject empty credentials explicitly: an empty string is still a `str`, so
  `checked` alone let an unconfigured forwarder send a request that could only
  ever be refused.
- Use `persistent_notification.async_create` instead of the sync variant.
- Use WINDY_MAX_RETRIES consistently; add POCASI_CZ_MAX_RETRIES.

Utils:
- `voc_level_to_text` / `battery_5step_to_pct` go through `to_int` like every
  other value_fn. A bare `int()` raised on a garbage payload value, which
  `WeatherSensor.native_value` then logged with a full traceback on every push.
  Out-of-range battery steps are clamped to a valid percentage.
- Simplify `check_disabled` (drop the redundant camelCase flag).

Config flow:
- `retain_data` re-reads SENSORS_TO_LOAD at submit time. Auto-discovery appends
  to it from the webhook handler, so writing back the snapshot taken when the
  step opened silently rolled back any sensor discovered meanwhile.

Coordinator:
- Drop the per-push staleness recalculation; the hourly timer already covers it.

Ecowitt:
- Tolerate aioecowitt moving/renaming the internal SENSOR_MAP rather than
  failing the whole module import; unit-variant dedup degrades instead.

Translations:
- Battery state key `unknown` -> `drained`: the entity emits UnitOfBat.UNKNOWN,
  whose value is "drained", so the old key never matched and the raw state
  leaked into the UI. cs.json was already correct.
- Remove the dead `migration` step; `async_step_migration` does not exist.

Also: remove verified-dead constants/helpers and fix ~30 docstring typos.
2026-07-25 21:47:54 +02:00
..
conftest.py Add HCHO / VOC air-quality sensors (T9 module) 2026-05-11 23:55:36 +02:00
test_binary_battery.py feat(device): merge all entities into one shared device with station-type model 2026-07-25 21:47:53 +02:00
test_config_flow.py fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +02:00
test_conflicts.py Add tests for legacy/Ecowitt protocol conflict 2026-07-25 21:47:54 +02:00
test_const.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_data.py fix: block enabling legacy and Ecowitt protocols together 2026-07-25 21:47:53 +02:00
test_diagnostics.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_ecowitt_bridge.py Add tests for legacy/Ecowitt protocol conflict 2026-07-25 21:47:54 +02:00
test_health.py fix: Prevent addon probe from failing config entry 2026-07-25 21:47:53 +02:00
test_init.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_integration_lifecycle.py chore(quality): manifest keys, ConfigEntryNotReady, remove dead sqlite code 2026-07-25 21:47:52 +02:00
test_pocasi_push.py fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +02:00
test_received_data.py fix(security): harden forwarders, cap native ecowitt entities, reject empty creds 2026-07-25 21:47:52 +02:00
test_received_ecowitt.py fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +02:00
test_routes.py Make routes method-aware and update related tests 2026-07-25 21:47:47 +02:00
test_routes_more.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_sensor_platform.py fix(correctness): reload-window guards, rate-limit races, ecowitt flush, dt_util 2026-07-25 21:47:52 +02:00
test_sensors_common.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_sensors_weather.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_sensors_wslink.py fix(correctness): reload-window guards, rate-limit races, ecowitt flush, dt_util 2026-07-25 21:47:52 +02:00
test_staleness_legacy.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_strings.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_t9_air_quality.py fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +02:00
test_translations_cs.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_translations_en.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_utils.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_utils_conv.py fix(security)+i18n: stop health-attribute leak, mask secrets in logs, sync translations 2026-07-25 21:47:52 +02:00
test_utils_more.py fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +02:00
test_weather_sensor_entity.py feat(device): merge all entities into one shared device with station-type model 2026-07-25 21:47:53 +02:00
test_windy_func.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_windy_more.py fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +02:00
test_windy_push.py fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +02:00