-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Abort reauth flows on config entry reload #140931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Tests fail because the reauth flow is now aborted early when reauth calls |
This is no longer relevant |
722d445
to
807ce27
Compare
tests/test_data_entry_flow.py
Outdated
async def test_create_aborted_flow(manager: MockFlowManager) -> None: | ||
"""Test return create_entry from aborted flow.""" | ||
|
||
@manager.mock_reg_handler("test") | ||
class TestFlow(data_entry_flow.FlowHandler): | ||
VERSION = 5 | ||
|
||
async def async_step_init(self, user_input=None): | ||
manager.async_abort(self.flow_id) | ||
return self.async_create_entry(title="Test Title", data="Test Data") | ||
|
||
with pytest.raises(data_entry_flow.UnknownFlow): | ||
await manager.async_init("test") | ||
assert len(manager.async_progress()) == 0 | ||
|
||
# The entry is created even if the flow is aborted | ||
assert len(manager.mock_created_entries) == 1 | ||
|
||
entry = manager.mock_created_entries[0] | ||
assert entry["handler"] == "test" | ||
assert entry["title"] == "Test Title" | ||
assert entry["data"] == "Test Data" | ||
assert entry["source"] is None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior is quite illogical; an entry is created without checking if the flow still exists, but there's then an error.
The behavior is not changed by this PR, but I think we should look into changing it in a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please add a comment to this test explaining that.
Looks good. Let me put it on production and test as well |
The bug is that frontend is not updated when the reauth flow is aborted on reload. This shows the same behavior with stale_reauth_flow_after_reload.mp4 |
This PR can be simplified a bit when #142138 is merged. |
The frontend issue should be fixed by home-assistant/frontend#24985 |
Proposed change
Abort reauth flows on config entry reload
Background here: #140723 (comment)
Needs #142079Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: