Ejemplo n.º 1
0
async def test_list_alexa_entities(hass, hass_ws_client, setup_api, mock_cloud_login):
    """Test that we can list Alexa entities."""
    client = await hass_ws_client(hass)
    entity = LightCapabilities(
        hass, MagicMock(entity_config={}), State("light.kitchen", "on")
    )
    with patch(
        "homeassistant.components.alexa.entities" ".async_get_entities",
        return_value=[entity],
    ):
        await client.send_json({"id": 5, "type": "cloud/alexa/entities"})
        response = await client.receive_json()

    assert response["success"]
    assert len(response["result"]) == 1
    assert response["result"][0] == {
        "entity_id": "light.kitchen",
        "display_categories": ["LIGHT"],
        "interfaces": ["Alexa.PowerController", "Alexa.EndpointHealth"],
    }
Ejemplo n.º 2
0
async def test_list_alexa_entities(hass, hass_ws_client, setup_api,
                                   mock_cloud_login):
    """Test that we can list Alexa entities."""
    client = await hass_ws_client(hass)
    entity = LightCapabilities(hass, MagicMock(entity_config={}),
                               State('light.kitchen', 'on'))
    with patch('homeassistant.components.alexa.entities'
               '.async_get_entities',
               return_value=[entity]):
        await client.send_json({
            'id': 5,
            'type': 'cloud/alexa/entities',
        })
        response = await client.receive_json()

    assert response['success']
    assert len(response['result']) == 1
    assert response['result'][0] == {
        'entity_id': 'light.kitchen',
        'display_categories': ['LIGHT'],
        'interfaces': ['Alexa.PowerController', 'Alexa.EndpointHealth'],
    }