Rename of the zwave hass.data constants (#7768)
* Rename of the zwave hass.data constants * Remove zwave since it is already implied
This commit is contained in:
1 parent
3a843e1817
commit
65c3201fa6
9 files changed
+47
-48
No files matched your search
@@ -1,7 +1,7 @@
|
||||
"""Test Z-Wave config panel."""
|
||||
import asyncio
|
||||
from unittest.mock import MagicMock
|
||||
from homeassistant.components.zwave import ZWAVE_NETWORK, const
|
||||
from homeassistant.components.zwave import DATA_NETWORK, const
|
||||
from homeassistant.components.zwave.api import (
|
||||
ZWaveNodeGroupView, ZWaveNodeConfigView, ZWaveUserCodeView)
|
||||
from tests.common import mock_http_component_app
|
||||
@@ -14,7 +14,7 @@ def test_get_groups(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveNodeGroupView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
node = MockNode(node_id=2)
|
||||
node.groups.associations = 'assoc'
|
||||
node.groups.associations_instances = 'inst'
|
||||
@@ -46,7 +46,7 @@ def test_get_groups_nogroups(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveNodeGroupView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
node = MockNode(node_id=2)
|
||||
|
||||
network.nodes = {2: node}
|
||||
@@ -67,7 +67,7 @@ def test_get_groups_nonode(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveNodeGroupView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
network.nodes = {1: 1, 5: 5}
|
||||
|
||||
client = yield from test_client(app)
|
||||
@@ -86,11 +86,11 @@ def test_get_config(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveNodeConfigView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
node = MockNode(node_id=2)
|
||||
value = MockValue(
|
||||
index=12,
|
||||
command_class=const.COMMAND_CLASS_CONFIGURATION)
|
||||
index=12,
|
||||
command_class=const.COMMAND_CLASS_CONFIGURATION)
|
||||
value.label = 'label'
|
||||
value.help = 'help'
|
||||
value.type = 'type'
|
||||
@@ -124,7 +124,7 @@ def test_get_config_noconfig_node(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveNodeConfigView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
node = MockNode(node_id=2)
|
||||
|
||||
network.nodes = {2: node}
|
||||
@@ -146,7 +146,7 @@ def test_get_config_nonode(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveNodeConfigView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
network.nodes = {1: 1, 5: 5}
|
||||
|
||||
client = yield from test_client(app)
|
||||
@@ -165,7 +165,7 @@ def test_get_usercodes_nonode(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveUserCodeView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
network.nodes = {1: 1, 5: 5}
|
||||
|
||||
client = yield from test_client(app)
|
||||
@@ -184,12 +184,12 @@ def test_get_usercodes(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveUserCodeView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
node = MockNode(node_id=18,
|
||||
command_classes=[const.COMMAND_CLASS_USER_CODE])
|
||||
value = MockValue(
|
||||
index=0,
|
||||
command_class=const.COMMAND_CLASS_USER_CODE)
|
||||
index=0,
|
||||
command_class=const.COMMAND_CLASS_USER_CODE)
|
||||
value.genre = const.GENRE_USER
|
||||
value.label = 'label'
|
||||
value.data = '1234'
|
||||
@@ -215,7 +215,7 @@ def test_get_usercode_nousercode_node(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveUserCodeView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
node = MockNode(node_id=18)
|
||||
|
||||
network.nodes = {18: node}
|
||||
@@ -237,12 +237,12 @@ def test_get_usercodes_no_genreuser(hass, test_client):
|
||||
app = mock_http_component_app(hass)
|
||||
ZWaveUserCodeView().register(app.router)
|
||||
|
||||
network = hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
network = hass.data[DATA_NETWORK] = MagicMock()
|
||||
node = MockNode(node_id=18,
|
||||
command_classes=[const.COMMAND_CLASS_USER_CODE])
|
||||
value = MockValue(
|
||||
index=0,
|
||||
command_class=const.COMMAND_CLASS_USER_CODE)
|
||||
index=0,
|
||||
command_class=const.COMMAND_CLASS_USER_CODE)
|
||||
value.genre = const.GENRE_SYSTEM
|
||||
value.label = 'label'
|
||||
value.data = '1234'
|
||||
|
||||
@@ -8,7 +8,7 @@ from homeassistant.const import ATTR_ENTITY_ID, EVENT_HOMEASSISTANT_START
|
||||
from homeassistant.components import zwave
|
||||
from homeassistant.components.binary_sensor.zwave import get_device
|
||||
from homeassistant.components.zwave import (
|
||||
const, CONFIG_SCHEMA, CONF_DEVICE_CONFIG_GLOB, ZWAVE_NETWORK)
|
||||
const, CONFIG_SCHEMA, CONF_DEVICE_CONFIG_GLOB, DATA_NETWORK)
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
import pytest
|
||||
@@ -82,7 +82,7 @@ def test_network_options(hass, mock_openzwave):
|
||||
|
||||
assert result
|
||||
|
||||
network = hass.data[zwave.ZWAVE_NETWORK]
|
||||
network = hass.data[zwave.DATA_NETWORK]
|
||||
assert network.options.device == 'mock_usb_path'
|
||||
assert network.options.config_path == 'mock_config_path'
|
||||
|
||||
@@ -94,7 +94,7 @@ def test_auto_heal_midnight(hass, mock_openzwave):
|
||||
'zwave': {
|
||||
'autoheal': True,
|
||||
}}))
|
||||
network = hass.data[zwave.ZWAVE_NETWORK]
|
||||
network = hass.data[zwave.DATA_NETWORK]
|
||||
assert not network.heal.called
|
||||
|
||||
time = datetime(2017, 5, 6, 0, 0, 0)
|
||||
@@ -111,7 +111,7 @@ def test_auto_heal_disabled(hass, mock_openzwave):
|
||||
'zwave': {
|
||||
'autoheal': False,
|
||||
}}))
|
||||
network = hass.data[zwave.ZWAVE_NETWORK]
|
||||
network = hass.data[zwave.DATA_NETWORK]
|
||||
assert not network.heal.called
|
||||
|
||||
time = datetime(2017, 5, 6, 0, 0, 0)
|
||||
@@ -139,8 +139,8 @@ def test_frontend_panel_register(hass, mock_openzwave):
|
||||
def test_setup_platform(hass, mock_openzwave):
|
||||
"""Test invalid device config."""
|
||||
mock_device = MagicMock()
|
||||
hass.data[ZWAVE_NETWORK] = MagicMock()
|
||||
hass.data[zwave.DATA_ZWAVE_DICT] = {456: mock_device}
|
||||
hass.data[DATA_NETWORK] = MagicMock()
|
||||
hass.data[zwave.DATA_DEVICES] = {456: mock_device}
|
||||
async_add_devices = MagicMock()
|
||||
|
||||
result = yield from zwave.async_setup_platform(
|
||||
@@ -170,7 +170,7 @@ def test_zwave_ready_wait(hass, mock_openzwave):
|
||||
|
||||
with patch.object(zwave.time, 'sleep') as mock_sleep:
|
||||
with patch.object(zwave, '_LOGGER') as mock_logger:
|
||||
hass.data[ZWAVE_NETWORK].state = MockNetwork.STATE_STARTED
|
||||
hass.data[DATA_NETWORK].state = MockNetwork.STATE_STARTED
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START)
|
||||
yield from hass.async_block_till_done()
|
||||
|
||||
@@ -772,7 +772,7 @@ class TestZWaveServices(unittest.TestCase):
|
||||
# Initialize zwave
|
||||
setup_component(self.hass, 'zwave', {'zwave': {}})
|
||||
self.hass.block_till_done()
|
||||
self.zwave_network = self.hass.data[ZWAVE_NETWORK]
|
||||
self.zwave_network = self.hass.data[DATA_NETWORK]
|
||||
self.zwave_network.state = MockNetwork.STATE_READY
|
||||
self.hass.bus.fire(EVENT_HOMEASSISTANT_START)
|
||||
self.hass.block_till_done()
|
||||
|
||||
Reference in new issue
Block a user