mirror of
https://github.com/home-assistant/core.git
synced 2025-12-22 11:59:34 +00:00
Clean up camera and demo camera (#34058)
* Clean up demo camera * Complete test_motion_detection * Clean up image reading * Clean up camera integration async methods * Fix and clean camera integration tests * Fix image processing patch
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""The tests for the image_processing component."""
|
||||
from unittest.mock import PropertyMock, patch
|
||||
from unittest.mock import PropertyMock
|
||||
|
||||
from asynctest import patch
|
||||
|
||||
import homeassistant.components.http as http
|
||||
import homeassistant.components.image_processing as ip
|
||||
@@ -69,18 +71,16 @@ class TestImageProcessing:
|
||||
self.hass.stop()
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.demo.camera.DemoCamera.camera_image",
|
||||
autospec=True,
|
||||
return_value=b"Test",
|
||||
"homeassistant.components.demo.camera.Path.read_bytes", return_value=b"Test",
|
||||
)
|
||||
def test_get_image_from_camera(self, mock_camera):
|
||||
def test_get_image_from_camera(self, mock_camera_read):
|
||||
"""Grab an image from camera entity."""
|
||||
common.scan(self.hass, entity_id="image_processing.test")
|
||||
self.hass.block_till_done()
|
||||
|
||||
state = self.hass.states.get("image_processing.test")
|
||||
|
||||
assert mock_camera.called
|
||||
assert mock_camera_read.called
|
||||
assert state.state == "1"
|
||||
assert state.attributes["image"] == b"Test"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user