Skip to content

Commit 738863a

Browse files
authored
Use ConfigFlowContext at Home Connect config flow tests (home-assistant#156132)
1 parent 59b3e65 commit 738863a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/components/home_connect/test_config_flow.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from homeassistant import config_entries, setup
1212
from homeassistant.components.home_connect.const import DOMAIN
13-
from homeassistant.config_entries import ConfigEntryState
13+
from homeassistant.config_entries import ConfigEntryState, ConfigFlowContext
1414
from homeassistant.core import HomeAssistant
1515
from homeassistant.data_entry_flow import FlowResultType
1616
from homeassistant.helpers import config_entry_oauth2_flow, device_registry as dr
@@ -104,7 +104,7 @@ async def test_full_flow(
104104
assert await setup.async_setup_component(hass, "home_connect", {})
105105

106106
result = await hass.config_entries.flow.async_init(
107-
"home_connect", context={"source": config_entries.SOURCE_USER}
107+
"home_connect", context=ConfigFlowContext(source=config_entries.SOURCE_USER)
108108
)
109109
state = config_entry_oauth2_flow._encode_jwt(
110110
hass,
@@ -159,7 +159,7 @@ async def test_prevent_reconfiguring_same_account(
159159
assert await setup.async_setup_component(hass, "home_connect", {})
160160

161161
result = await hass.config_entries.flow.async_init(
162-
"home_connect", context={"source": config_entries.SOURCE_USER}
162+
"home_connect", context=ConfigFlowContext(source=config_entries.SOURCE_USER)
163163
)
164164
state = config_entry_oauth2_flow._encode_jwt(
165165
hass,
@@ -312,7 +312,7 @@ async def test_zeroconf_flow(
312312
assert await setup.async_setup_component(hass, "home_connect", {})
313313

314314
result = await hass.config_entries.flow.async_init(
315-
DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}
315+
DOMAIN, context=ConfigFlowContext(source=config_entries.SOURCE_ZEROCONF)
316316
)
317317

318318
assert result["type"] is FlowResultType.FORM
@@ -375,7 +375,7 @@ async def test_zeroconf_flow_already_setup(
375375

376376
result = await hass.config_entries.flow.async_init(
377377
DOMAIN,
378-
context={"source": config_entries.SOURCE_ZEROCONF},
378+
context=ConfigFlowContext(source=config_entries.SOURCE_ZEROCONF),
379379
data=DHCP_DISCOVERY[0],
380380
)
381381
assert result["type"] is FlowResultType.ABORT
@@ -393,7 +393,9 @@ async def test_dhcp_flow(
393393
"""Test DHCP discovery."""
394394

395395
result = await hass.config_entries.flow.async_init(
396-
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=dhcp_discovery
396+
DOMAIN,
397+
context=ConfigFlowContext(source=config_entries.SOURCE_DHCP),
398+
data=dhcp_discovery,
397399
)
398400

399401
assert result["type"] is FlowResultType.FORM
@@ -452,7 +454,9 @@ async def test_dhcp_flow_already_setup(
452454
config_entry.add_to_hass(hass)
453455

454456
result = await hass.config_entries.flow.async_init(
455-
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=DHCP_DISCOVERY[0]
457+
DOMAIN,
458+
context=ConfigFlowContext(source=config_entries.SOURCE_DHCP),
459+
data=DHCP_DISCOVERY[0],
456460
)
457461
assert result["type"] is FlowResultType.ABORT
458462
assert result["reason"] == "already_configured"
@@ -499,7 +503,9 @@ async def test_dhcp_flow_complete_device_information(
499503
assert device.connections == set()
500504

501505
result = await hass.config_entries.flow.async_init(
502-
DOMAIN, context={"source": config_entries.SOURCE_DHCP}, data=dhcp_discovery
506+
DOMAIN,
507+
context=ConfigFlowContext(source=config_entries.SOURCE_DHCP),
508+
data=dhcp_discovery,
503509
)
504510
assert result["type"] is FlowResultType.ABORT
505511
assert result["reason"] == "already_configured"

0 commit comments

Comments
 (0)