From f171a9c18705690feb35617ae997014cd5a76808 Mon Sep 17 00:00:00 2001 From: Shivansh Shukla Date: Tue, 24 Nov 2026 15:08:22 +0530 Subject: [PATCH] Add test for updating non-existent user in config/auth (#193009) --- tests/components/config/test_auth.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/components/config/test_auth.py b/tests/components/config/test_auth.py index f166bf3d1207..0aa64808302d 100644 --- a/tests/components/config/test_auth.py +++ b/tests/components/config/test_auth.py @@ -378,6 +378,27 @@ async def test_update_invalid_group( assert user.groups == [] +async def test_update_not_found( + hass: HomeAssistant, hass_ws_client: WebSocketGenerator +) -> None: + """Test update command with an unknown user.""" + client = await hass_ws_client(hass) + + await client.send_json( + { + "id": 5, + "type": "config/auth/update", + "user_id": "non-existing-user", + "name": "Updated name", + } + ) + + result = await client.receive_json() + assert not result["success"], result + assert result["error"]["code"] == "not_found" + assert result["error"]["message"] == "User not found" + + async def test_deactivate( hass: HomeAssistant, hass_ws_client: WebSocketGenerator ) -> None: