Support for renaming ZWave values (#7780)

* Support for renaming ZWave values

* Improve test
This commit is contained in:
Adam Mills authored and Paulus Schoutsen committed 2017-06-08 21:35:26 -07:00
1 parent 4b767b088e
commit a8709a6988
6 files changed
+122 -7

No files matched your search

+31 -2
View File
@@ -3,9 +3,38 @@ import asyncio
from unittest.mock import MagicMock
from homeassistant.components.zwave import DATA_NETWORK, const
from homeassistant.components.zwave.api import (
ZWaveNodeGroupView, ZWaveNodeConfigView, ZWaveUserCodeView)
ZWaveNodeValueView, ZWaveNodeGroupView, ZWaveNodeConfigView,
ZWaveUserCodeView)
from tests.common import mock_http_component_app
from tests.mock.zwave import MockNode, MockValue
from tests.mock.zwave import MockNode, MockValue, MockEntityValues
@asyncio.coroutine
def test_get_values(hass, test_client):
"""Test getting values on node."""
app = mock_http_component_app(hass)
ZWaveNodeValueView().register(app.router)
node = MockNode(node_id=1)
value = MockValue(value_id=123456, node=node, label='Test Label')
values = MockEntityValues(primary=value)
node2 = MockNode(node_id=2)
value2 = MockValue(value_id=234567, node=node2, label='Test Label 2')
values2 = MockEntityValues(primary=value2)
hass.data[const.DATA_ENTITY_VALUES] = [values, values2]
client = yield from test_client(app)
resp = yield from client.get('/api/zwave/values/1')
assert resp.status == 200
result = yield from resp.json()
assert result == {
'123456': {
'label': 'Test Label',
}
}
@asyncio.coroutine