Use new enums in litterrobot tests (#62515)
* Use new enums in litterrobot tests * Code review: swap == for is
This commit is contained in:
parent
d3d6965ba0
commit
a7ef983a31
4 changed files with 12 additions and 19 deletions
|
@ -4,14 +4,10 @@ from unittest.mock import MagicMock
|
|||
from freezegun import freeze_time
|
||||
|
||||
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_ICON,
|
||||
ENTITY_CATEGORY_CONFIG,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_ICON, STATE_UNKNOWN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
|
||||
from .conftest import setup_integration
|
||||
|
||||
|
@ -31,7 +27,7 @@ async def test_button(hass: HomeAssistant, mock_account: MagicMock) -> None:
|
|||
|
||||
entry = entity_registry.async_get(BUTTON_ENTITY)
|
||||
assert entry
|
||||
assert entry.entity_category == ENTITY_CATEGORY_CONFIG
|
||||
assert entry.entity_category is EntityCategory.CONFIG
|
||||
|
||||
await hass.services.async_call(
|
||||
BUTTON_DOMAIN,
|
||||
|
|
|
@ -10,9 +10,10 @@ from homeassistant.components.select import (
|
|||
DOMAIN as PLATFORM_DOMAIN,
|
||||
SERVICE_SELECT_OPTION,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ENTITY_CATEGORY_CONFIG
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from .conftest import setup_integration
|
||||
|
@ -32,7 +33,7 @@ async def test_wait_time_select(hass: HomeAssistant, mock_account):
|
|||
ent_reg = entity_registry.async_get(hass)
|
||||
entity_entry = ent_reg.async_get(SELECT_ENTITY_ID)
|
||||
assert entity_entry
|
||||
assert entity_entry.entity_category == ENTITY_CATEGORY_CONFIG
|
||||
assert entity_entry.entity_category is EntityCategory.CONFIG
|
||||
|
||||
data = {ATTR_ENTITY_ID: SELECT_ENTITY_ID}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.components.litterrobot.sensor import LitterRobotSleepTimeSensor
|
||||
from homeassistant.components.sensor import DOMAIN as PLATFORM_DOMAIN
|
||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, PERCENTAGE
|
||||
from homeassistant.components.sensor import DOMAIN as PLATFORM_DOMAIN, SensorDeviceClass
|
||||
from homeassistant.const import PERCENTAGE
|
||||
|
||||
from .conftest import create_mock_robot, setup_integration
|
||||
|
||||
|
@ -30,7 +30,7 @@ async def test_sleep_time_sensor_with_none_state(hass):
|
|||
|
||||
assert sensor
|
||||
assert sensor.state is None
|
||||
assert sensor.device_class == DEVICE_CLASS_TIMESTAMP
|
||||
assert sensor.device_class is SensorDeviceClass.TIMESTAMP
|
||||
|
||||
|
||||
async def test_gauge_icon():
|
||||
|
|
|
@ -10,14 +10,10 @@ from homeassistant.components.switch import (
|
|||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ENTITY_CATEGORY_CONFIG,
|
||||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from .conftest import setup_integration
|
||||
|
@ -39,7 +35,7 @@ async def test_switch(hass: HomeAssistant, mock_account: MagicMock):
|
|||
ent_reg = entity_registry.async_get(hass)
|
||||
entity_entry = ent_reg.async_get(NIGHT_LIGHT_MODE_ENTITY_ID)
|
||||
assert entity_entry
|
||||
assert entity_entry.entity_category == ENTITY_CATEGORY_CONFIG
|
||||
assert entity_entry.entity_category is EntityCategory.CONFIG
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
Loading…
Add table
Reference in a new issue