Add test for incorrect config for Jewish Calendar (#71163)

* Loop load Jewish Calendar platforms

* Address review

* Add test for incorrect config

* add test to sensor platform
pull/71215/head
Yuval Aboulafia 2022-05-02 20:52:00 +03:00 committed by GitHub
parent 0926470ef0
commit 7c46eb5952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -4,6 +4,7 @@ from datetime import datetime as dt, timedelta
import pytest
from homeassistant.components import jewish_calendar
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers import entity_registry as er
from homeassistant.setup import async_setup_component
@ -302,3 +303,15 @@ async def test_issur_melacha_sensor_update(
hass.states.get("binary_sensor.test_issur_melacha_in_effect").state
== result[1]
)
async def test_no_discovery_info(hass, caplog):
"""Test setup without discovery info."""
assert BINARY_SENSOR_DOMAIN not in hass.config.components
assert await async_setup_component(
hass,
BINARY_SENSOR_DOMAIN,
{BINARY_SENSOR_DOMAIN: {"platform": jewish_calendar.DOMAIN}},
)
await hass.async_block_till_done()
assert BINARY_SENSOR_DOMAIN in hass.config.components

View File

@ -4,6 +4,7 @@ from datetime import datetime as dt, timedelta
import pytest
from homeassistant.components import jewish_calendar
from homeassistant.components.binary_sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.helpers import entity_registry as er
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util
@ -639,3 +640,15 @@ async def test_dafyomi_sensor(hass, test_time, result):
await hass.async_block_till_done()
assert hass.states.get("sensor.test_daf_yomi").state == result
async def test_no_discovery_info(hass, caplog):
"""Test setup without discovery info."""
assert SENSOR_DOMAIN not in hass.config.components
assert await async_setup_component(
hass,
SENSOR_DOMAIN,
{SENSOR_DOMAIN: {"platform": jewish_calendar.DOMAIN}},
)
await hass.async_block_till_done()
assert SENSOR_DOMAIN in hass.config.components