本文整理汇总了Python中tests.mock.zwave.MockNode.groups方法的典型用法代码示例。如果您正苦于以下问题:Python MockNode.groups方法的具体用法?Python MockNode.groups怎么用?Python MockNode.groups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.mock.zwave.MockNode
的用法示例。
在下文中一共展示了MockNode.groups方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_groups
# 需要导入模块: from tests.mock.zwave import MockNode [as 别名]
# 或者: from tests.mock.zwave.MockNode import groups [as 别名]
def test_get_groups(hass, test_client):
"""Test getting groupdata on node."""
app = mock_http_component_app(hass)
ZWaveNodeGroupView().register(app.router)
network = hass.data[DATA_NETWORK] = MagicMock()
node = MockNode(node_id=2)
node.groups.associations = 'assoc'
node.groups.associations_instances = 'inst'
node.groups.label = 'the label'
node.groups.max_associations = 'max'
node.groups = {1: node.groups}
network.nodes = {2: node}
client = yield from test_client(app)
resp = yield from client.get('/api/zwave/groups/2')
assert resp.status == 200
result = yield from resp.json()
assert result == {
'1': {
'association_instances': 'inst',
'associations': 'assoc',
'label': 'the label',
'max_associations': 'max'
}
}
示例2: test_get_groups
# 需要导入模块: from tests.mock.zwave import MockNode [as 别名]
# 或者: from tests.mock.zwave.MockNode import groups [as 别名]
def test_get_groups(hass, client):
"""Test getting groupdata on node."""
network = hass.data[DATA_NETWORK] = MagicMock()
node = MockNode(node_id=2)
node.groups.associations = 'assoc'
node.groups.associations_instances = 'inst'
node.groups.label = 'the label'
node.groups.max_associations = 'max'
node.groups = {1: node.groups}
network.nodes = {2: node}
resp = yield from client.get('/api/zwave/groups/2')
assert resp.status == 200
result = yield from resp.json()
assert result == {
'1': {
'association_instances': 'inst',
'associations': 'assoc',
'label': 'the label',
'max_associations': 'max'
}
}