Skip to content

data grand lyon: implement reauth#170059

Merged
zweckj merged 1 commit into
home-assistant:devfrom
Crocmagnon:devel/Crocmagnon/data_grand_lyon_reauth
May 8, 2026
Merged

data grand lyon: implement reauth#170059
zweckj merged 1 commit into
home-assistant:devfrom
Crocmagnon:devel/Crocmagnon/data_grand_lyon_reauth

Conversation

@Crocmagnon
Copy link
Copy Markdown
Contributor

@Crocmagnon Crocmagnon commented May 7, 2026

Proposed change

Implement reauth flow for data grand lyon.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a reauthentication path for the data_grand_lyon integration so Home Assistant can prompt the user to re-enter credentials when the upstream service returns an authorization error.

Changes:

  • Raise ConfigEntryAuthFailed from the coordinator on HTTP 401/403 responses to trigger a reauth flow.
  • Add reauth / reauth_confirm steps to the integration config flow and related translations.
  • Add/extend tests to validate both setup-triggered reauth and the reauth config flow (success + error paths), and mark the quality scale rule as done.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
homeassistant/components/data_grand_lyon/coordinator.py Detects auth failures (401/403) during updates and raises ConfigEntryAuthFailed to trigger reauth.
homeassistant/components/data_grand_lyon/config_flow.py Implements async_step_reauth / async_step_reauth_confirm to update credentials via UI.
homeassistant/components/data_grand_lyon/strings.json Adds translation keys for reauth step and success abort reason.
homeassistant/components/data_grand_lyon/quality_scale.yaml Marks the reauthentication-flow rule as completed.
tests/components/data_grand_lyon/test_init.py Adds a test asserting setup triggers a reauth flow on auth failure.
tests/components/data_grand_lyon/test_config_flow.py Adds tests for reauth flow success and error handling/recovery.

Comment thread homeassistant/components/data_grand_lyon/config_flow.py
@Crocmagnon Crocmagnon marked this pull request as ready for review May 7, 2026 21:16
Comment on lines +106 to +109
with patch(
"homeassistant.components.data_grand_lyon.config_flow.DataGrandLyonClient.get_tcl_passages",
return_value=[],
):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the rest of the file already uses that syntax, I will let it slide, but it would be better to use a fixture for that instead, to reduce indent and save code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback, I’ll clean that up in a future PR.

@zweckj zweckj merged commit 9fca2f2 into home-assistant:dev May 8, 2026
36 of 37 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 9, 2026
@Crocmagnon Crocmagnon deleted the devel/Crocmagnon/data_grand_lyon_reauth branch May 10, 2026 22:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants