Add password support (#12525)
parent
eec3bad94f
commit
f3748cc4fa
|
@ -58,6 +58,7 @@ ATTR_ADDONS = 'addons'
|
|||
ATTR_FOLDERS = 'folders'
|
||||
ATTR_HOMEASSISTANT = 'homeassistant'
|
||||
ATTR_NAME = 'name'
|
||||
ATTR_PASSWORD = 'password'
|
||||
|
||||
NO_TIMEOUT = {
|
||||
re.compile(r'^homeassistant/update$'),
|
||||
|
@ -87,6 +88,7 @@ SCHEMA_ADDON_STDIN = SCHEMA_ADDON.extend({
|
|||
|
||||
SCHEMA_SNAPSHOT_FULL = vol.Schema({
|
||||
vol.Optional(ATTR_NAME): cv.string,
|
||||
vol.Optional(ATTR_PASSWORD): cv.string,
|
||||
})
|
||||
|
||||
SCHEMA_SNAPSHOT_PARTIAL = SCHEMA_SNAPSHOT_FULL.extend({
|
||||
|
@ -96,6 +98,7 @@ SCHEMA_SNAPSHOT_PARTIAL = SCHEMA_SNAPSHOT_FULL.extend({
|
|||
|
||||
SCHEMA_RESTORE_FULL = vol.Schema({
|
||||
vol.Required(ATTR_SNAPSHOT): cv.slug,
|
||||
vol.Optional(ATTR_PASSWORD): cv.string,
|
||||
})
|
||||
|
||||
SCHEMA_RESTORE_PARTIAL = SCHEMA_RESTORE_FULL.extend({
|
||||
|
|
|
@ -276,12 +276,13 @@ def test_service_calls(hassio_env, hass, aioclient_mock):
|
|||
yield from hass.services.async_call('hassio', 'snapshot_partial', {
|
||||
'addons': ['test'],
|
||||
'folders': ['ssl'],
|
||||
'password': "123456",
|
||||
})
|
||||
yield from hass.async_block_till_done()
|
||||
|
||||
assert aioclient_mock.call_count == 8
|
||||
assert aioclient_mock.mock_calls[-1][2] == {
|
||||
'addons': ['test'], 'folders': ['ssl']}
|
||||
'addons': ['test'], 'folders': ['ssl'], 'password': "123456"}
|
||||
|
||||
yield from hass.services.async_call('hassio', 'restore_full', {
|
||||
'snapshot': 'test',
|
||||
|
@ -291,12 +292,15 @@ def test_service_calls(hassio_env, hass, aioclient_mock):
|
|||
'homeassistant': False,
|
||||
'addons': ['test'],
|
||||
'folders': ['ssl'],
|
||||
'password': "123456",
|
||||
})
|
||||
yield from hass.async_block_till_done()
|
||||
|
||||
assert aioclient_mock.call_count == 10
|
||||
assert aioclient_mock.mock_calls[-1][2] == {
|
||||
'addons': ['test'], 'folders': ['ssl'], 'homeassistant': False}
|
||||
'addons': ['test'], 'folders': ['ssl'], 'homeassistant': False,
|
||||
'password': "123456"
|
||||
}
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
|
|
Loading…
Reference in New Issue