mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
parent
29f680f912
commit
3eadfcc01d
@ -11,7 +11,7 @@ from homeassistant.const import CONF_ACCESS_TOKEN, CONF_TOKEN
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.config_entry_oauth2_flow import AbstractOAuth2FlowHandler
|
||||
|
||||
from .const import CONF_LOCATION_ID, DOMAIN, OLD_DATA, SCOPES
|
||||
from .const import CONF_LOCATION_ID, DOMAIN, OLD_DATA, REQUESTED_SCOPES, SCOPES
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -30,7 +30,7 @@ class SmartThingsConfigFlow(AbstractOAuth2FlowHandler, domain=DOMAIN):
|
||||
@property
|
||||
def extra_authorize_data(self) -> dict[str, Any]:
|
||||
"""Extra data that needs to be appended to the authorize url."""
|
||||
return {"scope": " ".join(SCOPES)}
|
||||
return {"scope": " ".join(REQUESTED_SCOPES)}
|
||||
|
||||
async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult:
|
||||
"""Create an entry for SmartThings."""
|
||||
|
@ -17,6 +17,12 @@ SCOPES = [
|
||||
"sse",
|
||||
]
|
||||
|
||||
REQUESTED_SCOPES = [
|
||||
*SCOPES,
|
||||
"r:installedapps",
|
||||
"w:installedapps",
|
||||
]
|
||||
|
||||
CONF_APP_ID = "app_id"
|
||||
CONF_CLOUDHOOK_URL = "cloudhook_url"
|
||||
CONF_INSTALLED_APP_ID = "installed_app_id"
|
||||
|
@ -57,7 +57,8 @@ async def test_full_flow(
|
||||
f"&state={state}"
|
||||
"&scope=r:devices:*+w:devices:*+x:devices:*+r:hubs:*+"
|
||||
"r:locations:*+w:locations:*+x:locations:*+r:scenes:*+"
|
||||
"x:scenes:*+r:rules:*+w:rules:*+sse"
|
||||
"x:scenes:*+r:rules:*+w:rules:*+sse+r:installedapps+"
|
||||
"w:installedapps"
|
||||
)
|
||||
|
||||
client = await hass_client_no_auth()
|
||||
@ -128,7 +129,8 @@ async def test_not_enough_scopes(
|
||||
f"&state={state}"
|
||||
"&scope=r:devices:*+w:devices:*+x:devices:*+r:hubs:*+"
|
||||
"r:locations:*+w:locations:*+x:locations:*+r:scenes:*+"
|
||||
"x:scenes:*+r:rules:*+w:rules:*+sse"
|
||||
"x:scenes:*+r:rules:*+w:rules:*+sse+r:installedapps+"
|
||||
"w:installedapps"
|
||||
)
|
||||
|
||||
client = await hass_client_no_auth()
|
||||
@ -190,7 +192,8 @@ async def test_duplicate_entry(
|
||||
f"&state={state}"
|
||||
"&scope=r:devices:*+w:devices:*+x:devices:*+r:hubs:*+"
|
||||
"r:locations:*+w:locations:*+x:locations:*+r:scenes:*+"
|
||||
"x:scenes:*+r:rules:*+w:rules:*+sse"
|
||||
"x:scenes:*+r:rules:*+w:rules:*+sse+r:installedapps+"
|
||||
"w:installedapps"
|
||||
)
|
||||
|
||||
client = await hass_client_no_auth()
|
||||
|
Loading…
x
Reference in New Issue
Block a user