Ejemplo n.º 1
0
async def test_sensor_not_supported(hass):
    """Test for Renault sensors with access denied failure."""
    await async_setup_component(hass, "persistent_notification", {})
    entity_registry = mock_registry(hass)
    device_registry = mock_device_registry(hass)

    not_supported_exception = exceptions.NotSupportedException(
        "err.tech.501",
        "This feature is not technically supported by this gateway",
    )

    vehicle_proxy = await create_vehicle_proxy_with_side_effect(
        hass, "zoe_40", not_supported_exception)

    with patch(
            "homeassistant.components.renault.RenaultHub.vehicles",
            new_callable=PropertyMock,
            return_value={
                vehicle_proxy.details.vin: vehicle_proxy,
            },
    ), patch("homeassistant.components.renault.PLATFORMS", [SENSOR_DOMAIN]):
        await setup_renault_integration(hass)
        await hass.async_block_till_done()

    assert len(device_registry.devices) == 0
    assert len(entity_registry.entities) == 0
Ejemplo n.º 2
0
def patch_fixtures_with_not_supported_exception():
    """Mock fixtures."""
    not_supported_exception = exceptions.NotSupportedException(
        "err.tech.501",
        "This feature is not technically supported by this gateway",
    )

    with _patch_fixtures_with_side_effect(not_supported_exception):
        yield
Ejemplo n.º 3
0
async def test_select_not_supported(hass: HomeAssistant):
    """Test for Renault selects with access denied failure."""
    await async_setup_component(hass, "persistent_notification", {})
    entity_registry = mock_registry(hass)
    device_registry = mock_device_registry(hass)

    vehicle_type = "zoe_40"
    not_supported_exception = exceptions.NotSupportedException(
        "err.tech.501",
        "This feature is not technically supported by this gateway",
    )

    with patch("homeassistant.components.renault.PLATFORMS", [SELECT_DOMAIN]):
        await setup_renault_integration_vehicle_with_side_effect(
            hass, vehicle_type, not_supported_exception)
        await hass.async_block_till_done()

    mock_vehicle = MOCK_VEHICLES[vehicle_type]
    check_device_registry(device_registry, mock_vehicle["expected_device"])

    assert len(entity_registry.entities) == 0