Fix hassfest allowing omitting discovery methods when using OAuth2Flow (#30732)
This commit is contained in:
parent
1f9d6ba541
commit
040b283a14
2 changed files with 4 additions and 0 deletions
|
@ -43,6 +43,7 @@ def generate_and_validate(integrations: Dict[str, Integration]):
|
||||||
content = fp.read()
|
content = fp.read()
|
||||||
if (
|
if (
|
||||||
" async_step_ssdp" not in content
|
" async_step_ssdp" not in content
|
||||||
|
and "AbstractOAuth2FlowHandler" not in content
|
||||||
and "register_discovery_flow" not in content
|
and "register_discovery_flow" not in content
|
||||||
):
|
):
|
||||||
integration.add_error("ssdp", "Config flow has no async_step_ssdp")
|
integration.add_error("ssdp", "Config flow has no async_step_ssdp")
|
||||||
|
|
|
@ -41,10 +41,12 @@ def generate_and_validate(integrations: Dict[str, Integration]):
|
||||||
with open(str(integration.path / "config_flow.py")) as fp:
|
with open(str(integration.path / "config_flow.py")) as fp:
|
||||||
content = fp.read()
|
content = fp.read()
|
||||||
uses_discovery_flow = "register_discovery_flow" in content
|
uses_discovery_flow = "register_discovery_flow" in content
|
||||||
|
uses_oauth2_flow = "AbstractOAuth2FlowHandler" in content
|
||||||
|
|
||||||
if (
|
if (
|
||||||
service_types
|
service_types
|
||||||
and not uses_discovery_flow
|
and not uses_discovery_flow
|
||||||
|
and not uses_oauth2_flow
|
||||||
and " async_step_zeroconf" not in content
|
and " async_step_zeroconf" not in content
|
||||||
):
|
):
|
||||||
integration.add_error(
|
integration.add_error(
|
||||||
|
@ -55,6 +57,7 @@ def generate_and_validate(integrations: Dict[str, Integration]):
|
||||||
if (
|
if (
|
||||||
homekit_models
|
homekit_models
|
||||||
and not uses_discovery_flow
|
and not uses_discovery_flow
|
||||||
|
and not uses_oauth2_flow
|
||||||
and " async_step_homekit" not in content
|
and " async_step_homekit" not in content
|
||||||
):
|
):
|
||||||
integration.add_error(
|
integration.add_error(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue