@@ -672,6 +672,20 @@ def _boom(*_args, **_kwargs):
672672 assert r .json ["checks" ]["database" ]["status" ] == "error"
673673 assert r .json ["checks" ]["database" ]["error" ] == "database_unavailable"
674674
675+ def test_readiness_survives_component_status_exception (self , client , monkeypatch ):
676+ import services .component_status_service as cs
677+
678+ def _boom (_session ):
679+ raise RuntimeError ("boom components" )
680+
681+ monkeypatch .setattr (cs , "build_component_status_payload" , _boom )
682+ r = client .get ("/api/ui/readiness" )
683+ assert r .status_code == 200
684+ data = r .json
685+ assert data ["ready" ] is True
686+ assert data ["components" ]["web" ] == "ok"
687+ assert data ["components" ]["processor" ] == "unknown"
688+
675689
676690class TestStatus :
677691 def test_status_returns_component_status (self , client ):
@@ -698,6 +712,21 @@ def test_status_esphome_reflects_feed_source(self, client):
698712 assert r .status_code == 200
699713 assert r .json ["esphome" ] in ("ok" , "error" , "not_configured" , "not_used" )
700714
715+ def test_status_survives_component_status_exception (self , client , monkeypatch ):
716+ from services .cache import cache_delete
717+
718+ import services .component_status_service as cs
719+
720+ def _boom (_session ):
721+ raise RuntimeError ("boom components" )
722+
723+ cache_delete ("component_status:v1" )
724+ monkeypatch .setattr (cs , "build_component_status_payload" , _boom )
725+ r = client .get ("/api/ui/status" )
726+ assert r .status_code == 200
727+ assert r .json ["web" ] == "ok"
728+ assert r .json ["processor" ] == "unknown"
729+
701730
702731class TestSettings :
703732 def test_settings_get_returns_config (self , client ):
0 commit comments