mirror of
https://github.com/home-assistant/core.git
synced 2025-08-10 16:15:08 +02:00
fix other tests.
This commit is contained in:
@@ -29,6 +29,7 @@ import homeassistant.helpers.config_validation as cv
|
|||||||
from homeassistant.components.frontend import register_built_in_panel
|
from homeassistant.components.frontend import register_built_in_panel
|
||||||
|
|
||||||
DOMAIN = 'automation'
|
DOMAIN = 'automation'
|
||||||
|
DEPENDENCIES = ['group']
|
||||||
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
||||||
|
|
||||||
GROUP_NAME_ALL_AUTOMATIONS = 'all automations'
|
GROUP_NAME_ALL_AUTOMATIONS = 'all automations'
|
||||||
|
@@ -24,6 +24,9 @@ from homeassistant.helpers.script import Script
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
DOMAIN = 'script'
|
||||||
|
DEPENDENCIES = ['group']
|
||||||
|
|
||||||
ATTR_CAN_CANCEL = 'can_cancel'
|
ATTR_CAN_CANCEL = 'can_cancel'
|
||||||
ATTR_LAST_ACTION = 'last_action'
|
ATTR_LAST_ACTION = 'last_action'
|
||||||
ATTR_LAST_TRIGGERED = 'last_triggered'
|
ATTR_LAST_TRIGGERED = 'last_triggered'
|
||||||
@@ -31,8 +34,6 @@ ATTR_VARIABLES = 'variables'
|
|||||||
|
|
||||||
CONF_SEQUENCE = 'sequence'
|
CONF_SEQUENCE = 'sequence'
|
||||||
|
|
||||||
DOMAIN = 'script'
|
|
||||||
|
|
||||||
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
||||||
|
|
||||||
GROUP_NAME_ALL_SCRIPTS = 'all scripts'
|
GROUP_NAME_ALL_SCRIPTS = 'all scripts'
|
||||||
|
@@ -57,7 +57,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
|||||||
def test_password_or_pub_key_required(self): \
|
def test_password_or_pub_key_required(self): \
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
"""Test creating an AsusWRT scanner without a pass or pubkey."""
|
"""Test creating an AsusWRT scanner without a pass or pubkey."""
|
||||||
with assert_setup_component(0):
|
with assert_setup_component(0, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'asuswrt',
|
CONF_PLATFORM: 'asuswrt',
|
||||||
@@ -82,7 +82,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(self.hass, DOMAIN, conf_dict)
|
assert setup_component(self.hass, DOMAIN, conf_dict)
|
||||||
|
|
||||||
conf_dict[DOMAIN][CONF_MODE] = 'router'
|
conf_dict[DOMAIN][CONF_MODE] = 'router'
|
||||||
@@ -108,7 +108,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(self.hass, DOMAIN, conf_dict)
|
assert setup_component(self.hass, DOMAIN, conf_dict)
|
||||||
|
|
||||||
conf_dict[DOMAIN][CONF_MODE] = 'router'
|
conf_dict[DOMAIN][CONF_MODE] = 'router'
|
||||||
@@ -192,7 +192,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
|||||||
update_mock.start()
|
update_mock.start()
|
||||||
self.addCleanup(update_mock.stop)
|
self.addCleanup(update_mock.stop)
|
||||||
|
|
||||||
with assert_setup_component(0):
|
with assert_setup_component(0, DOMAIN):
|
||||||
assert setup_component(self.hass, DOMAIN,
|
assert setup_component(self.hass, DOMAIN,
|
||||||
{DOMAIN: conf_dict})
|
{DOMAIN: conf_dict})
|
||||||
ssh.login.assert_not_called()
|
ssh.login.assert_not_called()
|
||||||
@@ -264,7 +264,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
|||||||
update_mock.start()
|
update_mock.start()
|
||||||
self.addCleanup(update_mock.stop)
|
self.addCleanup(update_mock.stop)
|
||||||
|
|
||||||
with assert_setup_component(0):
|
with assert_setup_component(0, DOMAIN):
|
||||||
assert setup_component(self.hass, DOMAIN,
|
assert setup_component(self.hass, DOMAIN,
|
||||||
{DOMAIN: conf_dict})
|
{DOMAIN: conf_dict})
|
||||||
telnet.login.assert_not_called()
|
telnet.login.assert_not_called()
|
||||||
|
@@ -57,7 +57,7 @@ class TestDdwrt(unittest.TestCase):
|
|||||||
mock_request.register_uri(
|
mock_request.register_uri(
|
||||||
'GET', r'http://%s/Status_Wireless.live.asp' % TEST_HOST,
|
'GET', r'http://%s/Status_Wireless.live.asp' % TEST_HOST,
|
||||||
status_code=401)
|
status_code=401)
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'ddwrt',
|
CONF_PLATFORM: 'ddwrt',
|
||||||
@@ -77,7 +77,7 @@ class TestDdwrt(unittest.TestCase):
|
|||||||
mock_request.register_uri(
|
mock_request.register_uri(
|
||||||
'GET', r'http://%s/Status_Wireless.live.asp' % TEST_HOST,
|
'GET', r'http://%s/Status_Wireless.live.asp' % TEST_HOST,
|
||||||
status_code=444)
|
status_code=444)
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'ddwrt',
|
CONF_PLATFORM: 'ddwrt',
|
||||||
@@ -95,7 +95,7 @@ class TestDdwrt(unittest.TestCase):
|
|||||||
'ddwrt.DdWrtDeviceScanner.get_ddwrt_data', return_value=None)
|
'ddwrt.DdWrtDeviceScanner.get_ddwrt_data', return_value=None)
|
||||||
def test_no_response(self, data_mock, error_mock):
|
def test_no_response(self, data_mock, error_mock):
|
||||||
"""Create a Ddwrt scanner with no response in init, should fail."""
|
"""Create a Ddwrt scanner with no response in init, should fail."""
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'ddwrt',
|
CONF_PLATFORM: 'ddwrt',
|
||||||
@@ -112,7 +112,7 @@ class TestDdwrt(unittest.TestCase):
|
|||||||
@mock.patch('homeassistant.components.device_tracker.ddwrt._LOGGER.error')
|
@mock.patch('homeassistant.components.device_tracker.ddwrt._LOGGER.error')
|
||||||
def test_get_timeout(self, mock_error, mock_request):
|
def test_get_timeout(self, mock_error, mock_request):
|
||||||
"""Test get Ddwrt data with request time out."""
|
"""Test get Ddwrt data with request time out."""
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'ddwrt',
|
CONF_PLATFORM: 'ddwrt',
|
||||||
@@ -140,7 +140,7 @@ class TestDdwrt(unittest.TestCase):
|
|||||||
'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST,
|
'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST,
|
||||||
text=load_fixture('Ddwrt_Status_Lan.txt'))
|
text=load_fixture('Ddwrt_Status_Lan.txt'))
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'ddwrt',
|
CONF_PLATFORM: 'ddwrt',
|
||||||
@@ -169,7 +169,7 @@ class TestDdwrt(unittest.TestCase):
|
|||||||
mock_request.register_uri(
|
mock_request.register_uri(
|
||||||
'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST, text=None)
|
'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST, text=None)
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'ddwrt',
|
CONF_PLATFORM: 'ddwrt',
|
||||||
@@ -198,7 +198,7 @@ class TestDdwrt(unittest.TestCase):
|
|||||||
text=load_fixture('Ddwrt_Status_Lan.txt').
|
text=load_fixture('Ddwrt_Status_Lan.txt').
|
||||||
replace('dhcp_leases', 'missing'))
|
replace('dhcp_leases', 'missing'))
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'ddwrt',
|
CONF_PLATFORM: 'ddwrt',
|
||||||
@@ -229,7 +229,7 @@ class TestDdwrt(unittest.TestCase):
|
|||||||
'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST,
|
'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST,
|
||||||
text=load_fixture('Ddwrt_Status_Lan.txt'))
|
text=load_fixture('Ddwrt_Status_Lan.txt'))
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'ddwrt',
|
CONF_PLATFORM: 'ddwrt',
|
||||||
@@ -249,7 +249,7 @@ class TestDdwrt(unittest.TestCase):
|
|||||||
'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST,
|
'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST,
|
||||||
text=load_fixture('Ddwrt_Status_Lan.txt'))
|
text=load_fixture('Ddwrt_Status_Lan.txt'))
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'ddwrt',
|
CONF_PLATFORM: 'ddwrt',
|
||||||
|
@@ -58,7 +58,7 @@ class TestUPCConnect(object):
|
|||||||
content=b'successful'
|
content=b'successful'
|
||||||
)
|
)
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'upc_connect',
|
CONF_PLATFORM: 'upc_connect',
|
||||||
@@ -84,7 +84,7 @@ class TestUPCConnect(object):
|
|||||||
status=404
|
status=404
|
||||||
)
|
)
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'upc_connect',
|
CONF_PLATFORM: 'upc_connect',
|
||||||
@@ -114,7 +114,7 @@ class TestUPCConnect(object):
|
|||||||
exc=asyncio.TimeoutError()
|
exc=asyncio.TimeoutError()
|
||||||
)
|
)
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'upc_connect',
|
CONF_PLATFORM: 'upc_connect',
|
||||||
@@ -143,7 +143,7 @@ class TestUPCConnect(object):
|
|||||||
content=b'successful',
|
content=b'successful',
|
||||||
)
|
)
|
||||||
|
|
||||||
with assert_setup_component(1):
|
with assert_setup_component(1, DOMAIN):
|
||||||
assert setup_component(
|
assert setup_component(
|
||||||
self.hass, DOMAIN, {DOMAIN: {
|
self.hass, DOMAIN, {DOMAIN: {
|
||||||
CONF_PLATFORM: 'upc_connect',
|
CONF_PLATFORM: 'upc_connect',
|
||||||
|
Reference in New Issue
Block a user