本文整理汇总了Python中tests.mock.zwave.MockValue.genre方法的典型用法代码示例。如果您正苦于以下问题:Python MockValue.genre方法的具体用法?Python MockValue.genre怎么用?Python MockValue.genre使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.mock.zwave.MockValue
的用法示例。
在下文中一共展示了MockValue.genre方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_usercodes_no_genreuser
# 需要导入模块: from tests.mock.zwave import MockValue [as 别名]
# 或者: from tests.mock.zwave.MockValue import genre [as 别名]
def test_get_usercodes_no_genreuser(hass, test_client):
"""Test getting usercodes on node missing genre user."""
app = mock_http_component_app(hass)
ZWaveUserCodeView().register(app.router)
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)
value.genre = const.GENRE_SYSTEM
value.label = 'label'
value.data = '1234'
node.values = {0: value}
network.nodes = {18: node}
node.get_values.return_value = node.values
client = yield from test_client(app)
resp = yield from client.get('/api/zwave/usercodes/18')
assert resp.status == 200
result = yield from resp.json()
assert result == {}
示例2: test_get_usercodes
# 需要导入模块: from tests.mock.zwave import MockValue [as 别名]
# 或者: from tests.mock.zwave.MockValue import genre [as 别名]
def test_get_usercodes(hass, client):
"""Test getting usercodes on node."""
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)
value.genre = const.GENRE_USER
value.label = 'label'
value.data = '1234'
node.values = {0: value}
network.nodes = {18: node}
node.get_values.return_value = node.values
resp = yield from client.get('/api/zwave/usercodes/18')
assert resp.status == 200
result = yield from resp.json()
assert result == {'0': {'code': '1234',
'label': 'label',
'length': 4}}