MCPcopy
hub / github.com/hacs/integration / test_already_configured

Function test_already_configured

tests/test_config_flow.py:306–327  ·  view source on GitHub ↗

Test we abort if already configured.

(
    hass: HomeAssistant,
    _mock_setup_entry: None,
    snapshots: SnapshotFixture,
    check_report_issue: None,
)

Source from the content-addressed store, hash-verified

304
305
306async def test_already_configured(
307 hass: HomeAssistant,
308 _mock_setup_entry: None,
309 snapshots: SnapshotFixture,
310 check_report_issue: None,
311) -> None:
312 """Test we abort if already configured."""
313 config_entry = create_config_entry()
314 config_entry.add_to_hass(hass)
315
316 result = await hass.config_entries.flow.async_init(
317 DOMAIN,
318 context={"source": config_entries.SOURCE_USER},
319 )
320 await hass.async_block_till_done()
321
322 assert result["type"] == FlowResultType.ABORT
323 snapshots.assert_match(
324 safe_json_dumps(recursive_remove_key(
325 result, ("flow_id", "minor_version"))),
326 "config_flow/test_already_configured.json",
327 )
328
329
330async def test_options_flow(hass: HomeAssistant, setup_integration: Generator) -> None:

Callers

nothing calls this directly

Calls 4

create_config_entryFunction · 0.90
safe_json_dumpsFunction · 0.90
recursive_remove_keyFunction · 0.90
add_to_hassMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…