mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Generate withings webhook ID in config flow (#100395)
This commit is contained in:
parent
d1afcd773f
commit
1737b27dd4
@ -8,8 +8,9 @@ from typing import Any
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from withings_api.common import AuthScope
|
from withings_api.common import AuthScope
|
||||||
|
|
||||||
|
from homeassistant.components.webhook import async_generate_id
|
||||||
from homeassistant.config_entries import ConfigEntry, OptionsFlowWithConfigEntry
|
from homeassistant.config_entries import ConfigEntry, OptionsFlowWithConfigEntry
|
||||||
from homeassistant.const import CONF_TOKEN
|
from homeassistant.const import CONF_TOKEN, CONF_WEBHOOK_ID
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
from homeassistant.helpers import config_entry_oauth2_flow
|
from homeassistant.helpers import config_entry_oauth2_flow
|
||||||
@ -77,7 +78,7 @@ class WithingsFlowHandler(
|
|||||||
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=DEFAULT_TITLE,
|
title=DEFAULT_TITLE,
|
||||||
data=data,
|
data={**data, CONF_WEBHOOK_ID: async_generate_id()},
|
||||||
options={CONF_USE_WEBHOOK: False},
|
options={CONF_USE_WEBHOOK: False},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ async def test_full_flow(
|
|||||||
assert "result" in result
|
assert "result" in result
|
||||||
assert result["result"].unique_id == "600"
|
assert result["result"].unique_id == "600"
|
||||||
assert "token" in result["result"].data
|
assert "token" in result["result"].data
|
||||||
|
assert "webhook_id" in result["result"].data
|
||||||
assert result["result"].data["token"]["access_token"] == "mock-access-token"
|
assert result["result"].data["token"]["access_token"] == "mock-access-token"
|
||||||
assert result["result"].data["token"]["refresh_token"] == "mock-refresh-token"
|
assert result["result"].data["token"]["refresh_token"] == "mock-refresh-token"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user