@@ -510,8 +510,8 @@ async def test_form_auth_resubmit_on_error(hass: HomeAssistant):
510510 await sess .ensure_authenticated ("https://example.com/main" )
511511 assert not sess ._form_authenticator ._should_submit
512512
513- # Notify scrape exception
514- sess .notify_scrape_exception ()
513+ # Invalidate auth (simulating coordinator passing force_reauth)
514+ sess .invalidate_auth ()
515515 assert sess ._form_authenticator ._should_submit
516516
517517 # Now it should submit again
@@ -763,19 +763,19 @@ def test_no_form_auth_returns_empty_variables(session):
763763
764764
765765@pytest .mark .unit
766- def test_notify_scrape_exception_without_form (session ):
767- """Test notify_scrape_exception is a no-op without form auth."""
766+ def test_invalidate_auth_without_form (session ):
767+ """Test invalidate_auth is a no-op without form auth."""
768768 # Should not raise
769- session .notify_scrape_exception ()
769+ session .invalidate_auth ()
770770
771771
772772@pytest .mark .unit
773- def test_notify_scrape_exception_resubmit_disabled (hass : HomeAssistant ):
774- """Test notify_scrape_exception does nothing when resubmit_on_error is False."""
773+ def test_invalidate_auth_resubmit_disabled (hass : HomeAssistant ):
774+ """Test invalidate_auth does nothing when resubmit_on_error is False."""
775775 form_config = make_form_config (resubmit_on_error = False )
776776 sess = make_form_session (hass , form_config )
777777 sess ._form_authenticator ._should_submit = False
778- sess .notify_scrape_exception ()
778+ sess .invalidate_auth ()
779779 assert not sess ._form_authenticator ._should_submit
780780
781781
@@ -1140,11 +1140,8 @@ async def test_e2e_form_resubmit_on_error(hass: HomeAssistant):
11401140 await request_manager .get_content ()
11411141 assert login_route .call_count == 1
11421142
1143- # Simulate scrape exception notification
1144- request_manager .notify_scrape_exception ()
1145-
1146- # Third call — form re-submits after error
1147- await request_manager .get_content ()
1143+ # Simulate coordinator passing force_reauth after scrape exception
1144+ await request_manager .get_content (force_reauth = True )
11481145 assert login_route .call_count == 2
11491146 finally :
11501147 await session .async_close ()
@@ -1704,15 +1701,12 @@ async def test_e2e_form_variables_updated_on_resubmit(hass: HomeAssistant):
17041701 await request_manager .get_content ()
17051702 assert session .form_variables ["api_token" ] == "token_v1"
17061703
1707- # Trigger resubmit
1708- request_manager .notify_scrape_exception ()
1709-
17101704 # Second auth returns token_v2
17111705 submit_route .mock (
17121706 return_value = respx .MockResponse (200 , text = FORM_RESPONSE_V2 )
17131707 )
17141708
1715- await request_manager .get_content ()
1709+ await request_manager .get_content (force_reauth = True )
17161710 assert session .form_variables ["api_token" ] == "token_v2"
17171711 finally :
17181712 await session .async_close ()
0 commit comments