Skip to content
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

Adjust default name in backup service calls to match documentation #94468

Merged
merged 1 commit into from Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion homeassistant/components/hassio/__init__.py
Expand Up @@ -159,7 +159,9 @@

SCHEMA_BACKUP_FULL = vol.Schema(
{
vol.Optional(ATTR_NAME): cv.string,
vol.Optional(
ATTR_NAME, default=lambda: utcnow().strftime("%Y-%m-%d %H:%M:%S")
): cv.string,
vol.Optional(ATTR_PASSWORD): cv.string,
vol.Optional(ATTR_COMPRESSED): cv.boolean,
vol.Optional(ATTR_LOCATION): vol.All(
Expand Down
5 changes: 5 additions & 0 deletions tests/components/hassio/test_init.py
Expand Up @@ -483,6 +483,7 @@ async def test_service_register(hassio_env, hass: HomeAssistant) -> None:
assert hass.services.has_service("hassio", "restore_partial")


@pytest.mark.freeze_time("2021-11-13 11:48:00")
async def test_service_calls(
hassio_env,
hass: HomeAssistant,
Expand Down Expand Up @@ -541,6 +542,7 @@ async def test_service_calls(

assert aioclient_mock.call_count == 14
assert aioclient_mock.mock_calls[-1][2] == {
"name": "2021-11-13 11:48:00",
"homeassistant": True,
"addons": ["test"],
"folders": ["ssl"],
Expand Down Expand Up @@ -575,13 +577,15 @@ async def test_service_calls(
"hassio",
"backup_full",
{
"name": "backup_name",
"location": "backup_share",
},
)
await hass.async_block_till_done()

assert aioclient_mock.call_count == 17
assert aioclient_mock.mock_calls[-1][2] == {
"name": "backup_name",
"location": "backup_share",
}

Expand All @@ -596,6 +600,7 @@ async def test_service_calls(

assert aioclient_mock.call_count == 18
assert aioclient_mock.mock_calls[-1][2] == {
"name": "2021-11-13 11:48:00",
"location": None,
}

Expand Down