mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
HassIO replace config changes (#9695)
* Update flow * fix tests * Update hassio.py
This commit is contained in:
parent
84271a2dac
commit
f34ebf733d
@ -17,7 +17,7 @@ import async_timeout
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.const import CONTENT_TYPE_TEXT_PLAIN
|
from homeassistant.const import CONTENT_TYPE_TEXT_PLAIN, SERVER_PORT
|
||||||
from homeassistant.components.http import (
|
from homeassistant.components.http import (
|
||||||
HomeAssistantView, KEY_AUTHENTICATED, CONF_API_PASSWORD, CONF_SERVER_PORT,
|
HomeAssistantView, KEY_AUTHENTICATED, CONF_API_PASSWORD, CONF_SERVER_PORT,
|
||||||
CONF_SSL_CERTIFICATE)
|
CONF_SSL_CERTIFICATE)
|
||||||
@ -129,16 +129,13 @@ class HassIO(object):
|
|||||||
|
|
||||||
This method return a coroutine.
|
This method return a coroutine.
|
||||||
"""
|
"""
|
||||||
|
port = http_config.get(CONF_SERVER_PORT) or SERVER_PORT
|
||||||
options = {
|
options = {
|
||||||
'ssl': CONF_SSL_CERTIFICATE in http_config,
|
'ssl': CONF_SSL_CERTIFICATE in http_config,
|
||||||
|
'port': port,
|
||||||
|
'password': http_config.get(CONF_API_PASSWORD),
|
||||||
}
|
}
|
||||||
|
|
||||||
if http_config.get(CONF_SERVER_PORT):
|
|
||||||
options['port'] = http_config[CONF_SERVER_PORT]
|
|
||||||
|
|
||||||
if http_config.get(CONF_API_PASSWORD):
|
|
||||||
options['password'] = http_config[CONF_API_PASSWORD]
|
|
||||||
|
|
||||||
return self.send_command("/homeassistant/options", payload=options)
|
return self.send_command("/homeassistant/options", payload=options)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
@ -105,8 +105,8 @@ def test_setup_api_push_api_data_default(hass, aioclient_mock):
|
|||||||
|
|
||||||
assert aioclient_mock.call_count == 2
|
assert aioclient_mock.call_count == 2
|
||||||
assert not aioclient_mock.mock_calls[-1][2]['ssl']
|
assert not aioclient_mock.mock_calls[-1][2]['ssl']
|
||||||
assert 'password' not in aioclient_mock.mock_calls[-1][2]
|
assert aioclient_mock.mock_calls[-1][2]['password'] is None
|
||||||
assert 'port' not in aioclient_mock.mock_calls[-1][2]
|
assert aioclient_mock.mock_calls[-1][2]['port'] == 8123
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user