Remove deprecated hass.components
from image_processing platform (#113613)
* Remove deprecated `hass.components` from image_processing platform * Add test and change log * D'oh.. use updated error text
This commit is contained in:
parent
0643ff1cfe
commit
b8e1862746
2 changed files with 28 additions and 7 deletions
|
@ -1,5 +1,4 @@
|
|||
"""The tests for the image_processing component."""
|
||||
|
||||
from unittest.mock import PropertyMock, patch
|
||||
|
||||
import pytest
|
||||
|
@ -103,7 +102,7 @@ async def test_get_image_from_camera(
|
|||
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.camera.async_get_image",
|
||||
"homeassistant.components.image_processing.async_get_image",
|
||||
side_effect=HomeAssistantError(),
|
||||
)
|
||||
async def test_get_image_without_exists_camera(
|
||||
|
@ -180,3 +179,22 @@ async def test_face_event_call_no_confidence(
|
|||
assert event_data[0]["confidence"] == 98.34
|
||||
assert event_data[0]["gender"] == "male"
|
||||
assert event_data[0]["entity_id"] == "image_processing.demo_face"
|
||||
|
||||
|
||||
async def test_update_missing_camera(
|
||||
hass: HomeAssistant,
|
||||
aiohttp_unused_port_factory,
|
||||
enable_custom_integrations: None,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test when entity does not set camera."""
|
||||
await setup_image_processing(hass, aiohttp_unused_port_factory)
|
||||
|
||||
with patch(
|
||||
"custom_components.test.image_processing.TestImageProcessing.camera_entity",
|
||||
new_callable=PropertyMock(return_value=None),
|
||||
):
|
||||
common.async_scan(hass, entity_id="image_processing.test")
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert "No camera entity id was set by the image processing entity" in caplog.text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue