fix(config_flow): no_state_source fires only when none of the three sources is present — ADB-only standalone is valid; strings/docs name all three (F2)

This commit is contained in:
James Mackay committed 2026-10-08 10:52:44 +01:00
1 parent 3b8e97fe5b
commit ce90f59f8e
5 files changed
+54 -6

No files matched your search

+34
View File
@@ -256,6 +256,40 @@ class TestStandaloneValidation:
assert CONF_ANDROIDTV_ENTITY not in result["data"]
class TestAdbOnlyStandalone:
async def test_adb_only_standalone_is_valid(self, tmp_path):
"""F2: ADB media-session mode is a third accepted state source."""
module = _form_module()
flow = module.NvidiaShieldConfigFlow()
flow.hass = FakeHass(str(tmp_path))
result = await flow.async_step_user(
_user_input(
**{
CONF_ANDROIDTV_ENTITY: "",
CONF_PROTOCOL_ENABLED: False,
"adb_enabled": True,
}
)
)
# routed into ADB pairing — no no_state_source error
assert result["type"] == "form"
assert result["step_id"] == "adb_pair"
assert result["errors"] == {}
async def test_error_still_fires_with_no_source_at_all(self, tmp_path):
module = _form_module()
flow = module.NvidiaShieldConfigFlow()
flow.hass = FakeHass(str(tmp_path))
result = await flow.async_step_user(
_user_input(**{CONF_ANDROIDTV_ENTITY: "", "adb_enabled": False})
)
assert result["errors"] == {"base": "no_state_source"}
class TestMigrationKeepsOrAllowsAbsence:
async def test_v1_to_v2_keeps_the_androidtv_field(self, tmp_path):
module = _entry_module()