Fix Cloud UI bug preventing managing Google 2FA (#34241)
* Fix Cloud UI bug preventing managing Google 2FA * Update comment
This commit is contained in:
1 parent
5f97937ba0
commit
0afb849e7f
5 files changed
+28
-10
No files matched your search
@@ -33,6 +33,7 @@ class MockConfig(helpers.AbstractConfig):
|
||||
"""Initialize config."""
|
||||
super().__init__(hass)
|
||||
self._should_expose = should_expose
|
||||
self._should_2fa = should_2fa
|
||||
self._secure_devices_pin = secure_devices_pin
|
||||
self._entity_config = entity_config or {}
|
||||
self._local_sdk_webhook_id = local_sdk_webhook_id
|
||||
@@ -73,6 +74,10 @@ class MockConfig(helpers.AbstractConfig):
|
||||
"""Expose it all."""
|
||||
return self._should_expose is None or self._should_expose(state)
|
||||
|
||||
def should_2fa(self, state):
|
||||
"""Expose it all."""
|
||||
return self._should_2fa is None or self._should_2fa(state)
|
||||
|
||||
|
||||
BASIC_CONFIG = MockConfig()
|
||||
|
||||
|
||||
@@ -845,10 +845,8 @@ async def test_lock_unlock_unlock(hass):
|
||||
assert err.value.code == const.ERR_CHALLENGE_NOT_SETUP
|
||||
|
||||
# Test with 2FA override
|
||||
with patch(
|
||||
"homeassistant.components.google_assistant.helpers"
|
||||
".AbstractConfig.should_2fa",
|
||||
return_value=False,
|
||||
with patch.object(
|
||||
BASIC_CONFIG, "should_2fa", return_value=False,
|
||||
):
|
||||
await trt.execute(trait.COMMAND_LOCKUNLOCK, BASIC_DATA, {"lock": False}, {})
|
||||
assert len(calls) == 2
|
||||
|
||||
Reference in new issue
Block a user