8000 Adjust reauth in awair config flow by epenet · Pull Request #72386 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adjust reauth in awair config flow #72386

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

Merged
merged 14 commits into from
Jun 27, 2022
Merged

Conversation

epenet
Copy link
Contributor
@epenet epenet commented May 23, 2022

Proposed change

Needed for #72830 and #72834

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)
  • 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:

Checklist

  • 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
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @ahayworth, @danielsjf, mind taking a look at this pull request as it has been labeled with an integration (awair) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@@ -42,7 +45,9 @@ async def async_step_user(self, user_input: dict | None = None):
errors=errors,
)

async def async_step_reauth(self, user_input: dict | None = None):
async def async_step_reauth(
self, user_input: dict[str, str] | None = None
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this a mapping?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this is a bug, and should be split between async_step_reauth and async_step_reauth_confirm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have adjusted this, but I think there might still be an underlying bug, since I think the user_input can never be None.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ahayworth / @danielsjf it seems to me that the old token is attempted again before asking the user for a new token.

Is this on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to clarify the situation, I have introduced a new step async_step_reauth_confirm
Since we are passing the current data to the new method, there is no change in behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

I will be honest and admit that I do not remember if there was an intentional "try the old token again" behavior. It's likely not what I intended. I found config flow rather confusing at the time I implemented it for Awair (I think it's gotten easier now!) ... so it's probably unintentional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is turning into a bigger PR than originally planned, but I've reworked the config flow to avoid the "try the old token again" behavior. I've also split the tests accordingly and the strings/translations.

It would be great if you could try it and confirm it is working correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @ahayworth, is there any chance you can test and/or approve the changes?
They are blocking #72830 and #72834

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @epenet - respectfully, if you wish to propose a change it is best if you're able to test it yourself. You should be able to register an Awair dev token at their portal and test enough of the config flow yourself to know if this change works fine or not: https://developer.getawair.com/onboard/welcome

I haven't had a lot of time to devote to open source in general recently, and I don't have the time right now to figure out how to run a dev branch locally again and test it, unfortunately.

I believe the best past forward is for you to try and test your own changes here.

@epenet epenet force-pushed the epenet-config-flow-type-hints-awair branch from 5d55d17 to ee3c8ce Compare June 7, 2022 06:14
@epenet epenet changed the title Adjust config-flow type hints in awair Adjust reauth in awair config flow Jun 7, 2022
@epenet epenet removed the small-pr PRs with less than 30 lines. label Jun 7, 2022
@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Jun 22, 2022
Copy link
Member
@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

I think this is ok since it's a small change and tested with the pytest tests.

We'll have to wait to merge until we solve our CI problems though.

@frenck frenck force-pushed the epenet-config-flow-type-hints-awair branch from f30e8e9 to 1ee580a Compare June 27, 2022 23:05
@frenck
Copy link
Member
frenck commented Jun 27, 2022

Rebased to deal with our CI issues

@frenck frenck merged commit b2c84a4 into dev Jun 27, 2022
@frenck frenck deleted the epenet-config-flow-type-hints-awair branch June 27, 2022 23:49
@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed code-quality integration: awair smash Indicator this PR is close to finish for merging or closing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0