-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup Google Cloud from the UI #121502
Setup Google Cloud from the UI #121502
Conversation
Hey there @lufton, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition to .strict-typing
could be done as a separate PR to reduce scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
async def test_user_flow_missing_file(hass: HomeAssistant) -> None: | ||
"""Test user flow when uploaded file is missing.""" | ||
result = await hass.config_entries.flow.async_init( | ||
DOMAIN, context={"source": config_entries.SOURCE_USER} | ||
) | ||
assert result["type"] is FlowResultType.FORM | ||
assert result["errors"] == {} | ||
|
||
with patch( | ||
"homeassistant.components.google_cloud.async_setup_entry", | ||
return_value=True, | ||
) as mock_setup_entry: | ||
result = await hass.config_entries.flow.async_configure( | ||
result["flow_id"], | ||
{UPLOADED_KEY_FILE: str(uuid4())}, | ||
) | ||
await hass.async_block_till_done() | ||
|
||
assert result["type"] is FlowResultType.FORM | ||
assert result["errors"] == {"base": "invalid_file"} | ||
assert len(mock_setup_entry.mock_calls) == 0 | ||
|
||
|
||
async def test_user_flow_invalid_file( | ||
hass: HomeAssistant, | ||
create_invalid_google_credentials_json: str, | ||
mock_process_uploaded_file: MagicMock, | ||
) -> None: | ||
"""Test user flow when uploaded file is invalid.""" | ||
result = await hass.config_entries.flow.async_init( | ||
DOMAIN, context={"source": config_entries.SOURCE_USER} | ||
) | ||
assert result["type"] is FlowResultType.FORM | ||
assert result["errors"] == {} | ||
|
||
uploaded_file = str(uuid4()) | ||
with patch( | ||
"homeassistant.components.google_cloud.async_setup_entry", | ||
return_value=True, | ||
) as mock_setup_entry: | ||
result = await hass.config_entries.flow.async_configure( | ||
result["flow_id"], | ||
{UPLOADED_KEY_FILE: uploaded_file}, | ||
) | ||
await hass.async_block_till_done() | ||
|
||
assert result["type"] is FlowResultType.FORM | ||
assert result["errors"] == {"base": "invalid_file"} | ||
mock_process_uploaded_file.assert_called_with(hass, uploaded_file) | ||
assert len(mock_setup_entry.mock_calls) == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure the tests end in either an abort or create entry to test the flow is able to recover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Thanks for the review! |
If it helps, while the context of this review is still fresh in your mind, I also have #120854 |
Breaking change
Proposed change
Google Cloud can now be setup from the UI
tts.google_cloud_say
service and avoid a breaking change.Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: