From 2a682c8a310f21be47649788253b884bee402d7a Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 19 Nov 2026 17:57:34 +0100 Subject: [PATCH] Remove redundant user check in Geocaching config flow (#193074) --- homeassistant/components/geocaching/config_flow.py | 2 +- tests/components/geocaching/test_config_flow.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/geocaching/config_flow.py b/homeassistant/components/geocaching/config_flow.py index 2a9e9cef92c2..da8468748be6 100644 --- a/homeassistant/components/geocaching/config_flow.py +++ b/homeassistant/components/geocaching/config_flow.py @@ -48,7 +48,7 @@ class GeocachingFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN): session=async_get_clientsession(self.hass), ) status = await api.update() - if not status.user or not status.user.username: + if not status.user.username: return self.async_abort(reason="oauth_error") if existing_entry := await self.async_set_unique_id( diff --git a/tests/components/geocaching/test_config_flow.py b/tests/components/geocaching/test_config_flow.py index dc6d9f2a2802..e78e90aa7335 100644 --- a/tests/components/geocaching/test_config_flow.py +++ b/tests/components/geocaching/test_config_flow.py @@ -161,8 +161,8 @@ async def test_oauth_error( resp = await client.get(f"/auth/external/callback?code=abcd&state={state}") assert resp.status == HTTPStatus.OK - # No user information is returned from API - mock_geocaching_config_flow.update.return_value.user = None + # No username is returned from API + mock_geocaching_config_flow.update.return_value.user.username = None aioclient_mock.post( CURRENT_ENVIRONMENT_URLS["token_url"],