core/tests/components/axis/test_camera.py

31 lines
904 B
Python
Raw Normal View History

"""Axis camera platform tests."""
from homeassistant.components.axis.const import DOMAIN as AXIS_DOMAIN
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
from homeassistant.setup import async_setup_component
2020-01-02 23:02:59 +00:00
from .test_device import NAME, setup_axis_integration
async def test_platform_manually_configured(hass):
"""Test that nothing happens when platform is manually configured."""
2019-07-31 19:25:30 +00:00
assert (
await async_setup_component(
hass, CAMERA_DOMAIN, {"camera": {"platform": AXIS_DOMAIN}}
2019-07-31 19:25:30 +00:00
)
is True
)
assert AXIS_DOMAIN not in hass.data
async def test_camera(hass):
"""Test that Axis camera platform is loaded properly."""
2020-01-02 23:02:59 +00:00
await setup_axis_integration(hass)
assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 1
2020-01-02 23:02:59 +00:00
cam = hass.states.get(f"camera.{NAME}")
2019-07-31 19:25:30 +00:00
assert cam.state == "idle"
2020-01-02 23:02:59 +00:00
assert cam.name == NAME