mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Bump iCloud to 0.9.2 + fix setup log (#31273)
- pyicloud to 0.9.2 - fix log `ERROR (MainThread) [homeassistant.config_entries] icloud.async_setup_entry did not return boolean`
This commit is contained in:
parent
fa15bead94
commit
ec4ccb10ec
@ -122,6 +122,9 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
||||
hass, username, password, icloud_dir, max_interval, gps_accuracy_threshold,
|
||||
)
|
||||
await hass.async_add_executor_job(account.setup)
|
||||
if not account.devices:
|
||||
return False
|
||||
|
||||
hass.data[DOMAIN][username] = account
|
||||
|
||||
for component in ICLOUD_COMPONENTS:
|
||||
@ -207,3 +210,5 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
||||
hass.services.async_register(
|
||||
DOMAIN, SERVICE_ICLOUD_UPDATE, update_account, schema=SERVICE_SCHEMA
|
||||
)
|
||||
|
||||
return True
|
||||
|
@ -98,7 +98,7 @@ class IcloudFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
errors[CONF_USERNAME] = "login"
|
||||
return await self._show_setup_form(user_input, errors)
|
||||
|
||||
if self.api.requires_2fa:
|
||||
if self.api.requires_2sa:
|
||||
return await self.async_step_trusted_device()
|
||||
|
||||
return self.async_create_entry(
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "Apple iCloud",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/icloud",
|
||||
"requirements": ["pyicloud==0.9.1"],
|
||||
"requirements": ["pyicloud==0.9.2"],
|
||||
"dependencies": [],
|
||||
"codeowners": ["@Quentame"]
|
||||
}
|
||||
|
@ -1294,7 +1294,7 @@ pyhomeworks==0.0.6
|
||||
pyialarm==0.3
|
||||
|
||||
# homeassistant.components.icloud
|
||||
pyicloud==0.9.1
|
||||
pyicloud==0.9.2
|
||||
|
||||
# homeassistant.components.intesishome
|
||||
pyintesishome==1.6
|
||||
|
@ -451,7 +451,7 @@ pyheos==0.6.0
|
||||
pyhomematic==0.1.63
|
||||
|
||||
# homeassistant.components.icloud
|
||||
pyicloud==0.9.1
|
||||
pyicloud==0.9.2
|
||||
|
||||
# homeassistant.components.ipma
|
||||
pyipma==2.0.2
|
||||
|
@ -39,7 +39,7 @@ def mock_controller_service():
|
||||
with patch(
|
||||
"homeassistant.components.icloud.config_flow.PyiCloudService"
|
||||
) as service_mock:
|
||||
service_mock.return_value.requires_2fa = True
|
||||
service_mock.return_value.requires_2sa = True
|
||||
service_mock.return_value.trusted_devices = TRUSTED_DEVICES
|
||||
service_mock.return_value.send_verification_code = Mock(return_value=True)
|
||||
service_mock.return_value.validate_verification_code = Mock(return_value=True)
|
||||
@ -52,7 +52,7 @@ def mock_controller_service_with_cookie():
|
||||
with patch(
|
||||
"homeassistant.components.icloud.config_flow.PyiCloudService"
|
||||
) as service_mock:
|
||||
service_mock.return_value.requires_2fa = False
|
||||
service_mock.return_value.requires_2sa = False
|
||||
service_mock.return_value.trusted_devices = TRUSTED_DEVICES
|
||||
service_mock.return_value.send_verification_code = Mock(return_value=True)
|
||||
service_mock.return_value.validate_verification_code = Mock(return_value=True)
|
||||
@ -65,7 +65,7 @@ def mock_controller_service_send_verification_code_failed():
|
||||
with patch(
|
||||
"homeassistant.components.icloud.config_flow.PyiCloudService"
|
||||
) as service_mock:
|
||||
service_mock.return_value.requires_2fa = True
|
||||
service_mock.return_value.requires_2sa = True
|
||||
service_mock.return_value.trusted_devices = TRUSTED_DEVICES
|
||||
service_mock.return_value.send_verification_code = Mock(return_value=False)
|
||||
yield service_mock
|
||||
@ -77,7 +77,7 @@ def mock_controller_service_validate_verification_code_failed():
|
||||
with patch(
|
||||
"homeassistant.components.icloud.config_flow.PyiCloudService"
|
||||
) as service_mock:
|
||||
service_mock.return_value.requires_2fa = True
|
||||
service_mock.return_value.requires_2sa = True
|
||||
service_mock.return_value.trusted_devices = TRUSTED_DEVICES
|
||||
service_mock.return_value.send_verification_code = Mock(return_value=True)
|
||||
service_mock.return_value.validate_verification_code = Mock(return_value=False)
|
||||
@ -324,7 +324,7 @@ async def test_verification_code_success(hass: HomeAssistantType, service: Magic
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_TRUSTED_DEVICE: 0}
|
||||
)
|
||||
service.return_value.requires_2fa = False
|
||||
service.return_value.requires_2sa = False
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_VERIFICATION_CODE: "0"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user