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:
parent
5b37096b5f
commit
c92945ecd6
5 changed files with 54 additions and 22 deletions
22
tests/components/netatmo/test_api.py
Normal file
22
tests/components/netatmo/test_api.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue