* Add Israel Rail integration * israel_rail tests * israel_rail tests * 1. use entry.runtime 2. DataConnection - data class 3. remove unique id from coordinator 4. use EntityDescription * add a list of stations in user form * 1. extend ConfigEntry 2. remove unused pop 3. use IsraelRailSensorEntityDescription to have only one kind of Sensor 4. add test for already configured 5. use snapshot in test * change user step description * 1. ConfigEntry[IsraelRailDataUpdateCoordinator] 2. remove redundant attributes 3. use snapshot_platform helper * remove attr * remove attr * move test to test_init.py * Fix * Fix * Fix * Fix * fix timezone * fix * fix --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
22 lines
690 B
Python
22 lines
690 B
Python
"""Test init of israel_rail integration."""
|
|
|
|
from unittest.mock import AsyncMock
|
|
|
|
from homeassistant.config_entries import ConfigEntryState
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from . import init_integration
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
async def test_invalid_config(
|
|
hass: HomeAssistant,
|
|
mock_config_entry: MockConfigEntry,
|
|
mock_israelrail: AsyncMock,
|
|
) -> None:
|
|
"""Ensure nothing is created when config is wrong."""
|
|
mock_israelrail.query.side_effect = Exception("error")
|
|
await init_integration(hass, mock_config_entry)
|
|
assert not hass.states.async_entity_ids("sensor")
|
|
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY
|