Fix netatmo authentication when using cloud authentication credentials (#104021)

* Fix netatmo authentication loop

* Update unit tests

* Move logic to determine api scopes

* Add unit tests for new method

* Use pyatmo scope list (#1)

* Exclude scopes not working with cloud

* Fix linting error

---------

Co-authored-by: Tobias Sauerwein <cgtobi@users.noreply.github.com>
This commit is contained in:
deosrc 2023-11-15 20:28:16 +00:00 committed by GitHub
parent 5b37096b5f
commit c92945ecd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 22 deletions

View file

@ -0,0 +1,22 @@
"""The tests for the Netatmo api."""
from pyatmo.const import ALL_SCOPES
from homeassistant.components import cloud
from homeassistant.components.netatmo import api
from homeassistant.components.netatmo.const import API_SCOPES_EXCLUDED_FROM_CLOUD
async def test_get_api_scopes_cloud() -> None:
"""Test method to get API scopes when using cloud auth implementation."""
result = api.get_api_scopes(cloud.DOMAIN)
for scope in API_SCOPES_EXCLUDED_FROM_CLOUD:
assert scope not in result
async def test_get_api_scopes_other() -> None:
"""Test method to get API scopes when using cloud auth implementation."""
result = api.get_api_scopes("netatmo_239846i2f0j2")
assert sorted(ALL_SCOPES) == result