@@ -476,3 +476,49 @@ async def test_forecast_subscription(
476476
477477 assert forecast2 != []
478478 assert forecast2 == snapshot
479+
480+
481+ @pytest .mark .parametrize (
482+ ("forecast_type" , "entity_id" ),
483+ [("hourly" , "weather.abc" )],
484+ )
485+ async def test_forecast_subscription_with_failing_coordinator (
486+ hass : HomeAssistant ,
487+ hass_ws_client : WebSocketGenerator ,
488+ freezer : FrozenDateTimeFactory ,
489+ snapshot : SnapshotAssertion ,
490+ mock_simple_nws_times_out ,
491+ no_sensor ,
492+ forecast_type : str ,
493+ entity_id : str ,
494+ ) -> None :
495+ """Test a forecast subscription when the coordinator is failing to update."""
496+ client = await hass_ws_client (hass )
497+
498+ registry = er .async_get (hass )
499+ # Pre-create the hourly entity
500+ registry .async_get_or_create (
501+ WEATHER_DOMAIN ,
502+ nws .DOMAIN ,
503+ "35_-75_hourly" ,
504+ suggested_object_id = "abc_hourly" ,
505+ )
506+
507+ entry = MockConfigEntry (
508+ domain = nws .DOMAIN ,
509+ data = NWS_CONFIG ,
510+ )
511+ entry .add_to_hass (hass )
512+
513+ await hass .config_entries .async_setup (entry .entry_id )
514+ await hass .async_block_till_done ()
515+
516+ await client .send_json_auto_id (
517+ {
518+ "type" : "weather/subscribe_forecast" ,
519+ "forecast_type" : forecast_type ,
520+ "entity_id" : entity_id ,
521+ }
522+ )
523+ msg = await client .receive_json ()
524+ assert not msg ["success" ]
0 commit comments