mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Set single_config_entry in cpuspeed (#131486)
* Set single_config_entry in cpuspeed * Adjust tests
This commit is contained in:
parent
428d7d1ad8
commit
9f8a656eff
@ -23,7 +23,6 @@ class CPUSpeedFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a flow initialized by the user."""
|
"""Handle a flow initialized by the user."""
|
||||||
await self.async_set_unique_id(DOMAIN)
|
await self.async_set_unique_id(DOMAIN)
|
||||||
self._abort_if_unique_id_configured()
|
|
||||||
|
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self.async_show_form(step_id="user")
|
return self.async_show_form(step_id="user")
|
||||||
|
@ -6,5 +6,6 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/cpuspeed",
|
"documentation": "https://www.home-assistant.io/integrations/cpuspeed",
|
||||||
"integration_type": "device",
|
"integration_type": "device",
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"requirements": ["py-cpuinfo==9.0.0"]
|
"requirements": ["py-cpuinfo==9.0.0"],
|
||||||
|
"single_config_entry": true
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "[%key:common::config_flow::abort::single_instance_allowed%]",
|
|
||||||
"not_compatible": "Unable to get CPU information, this integration is not compatible with your system"
|
"not_compatible": "Unable to get CPU information, this integration is not compatible with your system"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1057,7 +1057,8 @@
|
|||||||
"cpuspeed": {
|
"cpuspeed": {
|
||||||
"integration_type": "device",
|
"integration_type": "device",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"iot_class": "local_push"
|
"iot_class": "local_push",
|
||||||
|
"single_config_entry": true
|
||||||
},
|
},
|
||||||
"cribl": {
|
"cribl": {
|
||||||
"name": "Cribl",
|
"name": "Cribl",
|
||||||
|
@ -50,7 +50,7 @@ async def test_already_configured(
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert result.get("type") is FlowResultType.ABORT
|
assert result.get("type") is FlowResultType.ABORT
|
||||||
assert result.get("reason") == "already_configured"
|
assert result.get("reason") == "single_instance_allowed"
|
||||||
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 0
|
assert len(mock_setup_entry.mock_calls) == 0
|
||||||
assert len(mock_cpuinfo_config_flow.mock_calls) == 0
|
assert len(mock_cpuinfo_config_flow.mock_calls) == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user