1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Use fixtures to setup Axis integration in tests (#86034)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Robert Svensson
2023-01-22 17:33:40 +01:00
committed by GitHub
parent 8e117ee499
commit 332d3e0f19
10 changed files with 491 additions and 485 deletions

View File

@@ -13,8 +13,7 @@ from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
from homeassistant.const import STATE_IDLE
from homeassistant.setup import async_setup_component
from .conftest import NAME
from .test_device import setup_axis_integration
from .const import NAME
async def test_platform_manually_configured(hass):
@@ -29,10 +28,8 @@ async def test_platform_manually_configured(hass):
assert AXIS_DOMAIN not in hass.data
async def test_camera(hass, config_entry):
async def test_camera(hass, setup_config_entry):
"""Test that Axis camera platform is loaded properly."""
await setup_axis_integration(hass, config_entry)
assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 1
entity_id = f"{CAMERA_DOMAIN}.{NAME}"
@@ -51,10 +48,8 @@ async def test_camera(hass, config_entry):
@pytest.mark.parametrize("options", [{CONF_STREAM_PROFILE: "profile_1"}])
async def test_camera_with_stream_profile(hass, config_entry):
async def test_camera_with_stream_profile(hass, setup_config_entry):
"""Test that Axis camera entity is using the correct path with stream profike."""
await setup_axis_integration(hass, config_entry)
assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 1
entity_id = f"{CAMERA_DOMAIN}.{NAME}"
@@ -75,9 +70,9 @@ async def test_camera_with_stream_profile(hass, config_entry):
)
async def test_camera_disabled(hass, config_entry):
async def test_camera_disabled(hass, prepare_config_entry):
"""Test that Axis camera platform is loaded properly but does not create camera entity."""
with patch("axis.vapix.vapix.Params.image_format", new=None):
await setup_axis_integration(hass, config_entry)
await prepare_config_entry()
assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 0