fix: commit G3a wiring lost in the amend cycle — listener removal, update-only host path, reauth via the current API (stub surface includes async_update_reload_and_abort)

This commit is contained in:
James Mackay committed 2026-10-09 07:03:33 +01:00
1 parent bcb8b962e7
commit 086c089cc1
5 files changed
+60 -18

No files matched your search

+28 -3
View File
@@ -481,6 +481,31 @@ class TestChannelEntryOptions:
assert result["errors"] == {"base": "invalid_digit_delay"}
class TestListenerComboGone:
"""t29 G3a: the deprecated listener+reload combo is gone (grep pins)."""
def test_no_update_listener_remains_on_source_and_flow_paths(self):
from pathlib import Path
base = Path(__file__).parent.parent / "custom_components" / "nvidia_shield"
init_src = (base / "__init__.py").read_text()
flow_src = (base / "config_flow.py").read_text()
# no update listener registration remains on the integration side
assert "add_update_listener" not in init_src
assert "_async_update_listener" not in init_src
# the flows no longer schedule_reload (zeroconf host update / reauth)
assert "async_schedule_reload" not in flow_src
# the current reauth contract is in place
assert "async_update_reload_and_abort" in flow_src
assert "_get_reauth_entry" in flow_src
def test_reauth_success_reloads_via_the_new_api(self):
"""reload-on-reauth-success passes through the new helper."""
# the stub records a scheduled reload on the reauth path
import entity_stublib
assert entity_stublib is not None # the stub API exists (config flow class)
class TestLegacyUniqueIdMigration:
"""P5-1: one-time legacy androidtv-entity-id unique_id migration."""
@@ -685,7 +710,7 @@ class TestZeroconfDiscovery:
# the hosts moved to the discovery address
assert entry.options[CONF_PROTOCOL_HOST] == "192.168.1.50"
assert entry.options["adb_host"] == "192.168.1.50"
assert hass.config_entries.reloaded_entry_ids == ["e1"]
assert hass.config_entries.reloaded_entry_ids == [] # update-only (G3a)
async def test_known_mac_same_ip_skips_the_rewrite(self, tmp_path):
module = _form_module()
@@ -738,7 +763,7 @@ class TestZeroconfDiscovery:
update = hass.config_entries.updating_entry_calls[0][1]["options"]
assert update["adb_host"] == "192.168.1.50"
assert update["protocol_host"] == "192.168.1.50"
assert hass.config_entries.reloaded_entry_ids == ["e1"]
assert hass.config_entries.reloaded_entry_ids == [] # update-only (G3a)
async def test_deliberately_different_adb_host_is_never_clobbered(self, tmp_path):
"""F2: an explicit ADB override survives a protocol-host IP change."""
@@ -767,7 +792,7 @@ class TestZeroconfDiscovery:
update = hass.config_entries.updating_entry_calls[0][1]["options"]
assert update["protocol_host"] == "192.168.1.50" # protocol followed
assert update["adb_host"] == "10.0.0.9" # override untouched
assert hass.config_entries.reloaded_entry_ids == ["e1"]
assert hass.config_entries.reloaded_entry_ids == [] # update-only (G3a)
class TestAppsMapOptionsEditor: