2019-03-24 15:16:50 +00:00
|
|
|
"""Axis camera platform tests."""
|
|
|
|
|
2020-05-14 08:49:27 +00:00
|
|
|
from homeassistant.components.axis.const import DOMAIN as AXIS_DOMAIN
|
|
|
|
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
|
2019-12-08 14:44:04 +00:00
|
|
|
from homeassistant.setup import async_setup_component
|
2019-03-24 15:16:50 +00:00
|
|
|
|
2020-01-02 23:02:59 +00:00
|
|
|
from .test_device import NAME, setup_axis_integration
|
2019-03-24 15:16:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
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(
|
2020-05-14 08:49:27 +00:00
|
|
|
hass, CAMERA_DOMAIN, {"camera": {"platform": AXIS_DOMAIN}}
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
|
|
|
is True
|
|
|
|
)
|
2019-03-24 15:16:50 +00:00
|
|
|
|
2020-05-14 08:49:27 +00:00
|
|
|
assert AXIS_DOMAIN not in hass.data
|
2019-03-24 15:16:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
2019-03-24 15:16:50 +00:00
|
|
|
|
2020-05-14 08:49:27 +00:00
|
|
|
assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 1
|
2019-03-24 15:16:50 +00:00
|
|
|
|
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
|