mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Add image test cases to generic (#69040)
This commit is contained in:
parent
1563420de8
commit
c3354dcaae
BIN
tests/components/generic/sample1_animate.png
Normal file
BIN
tests/components/generic/sample1_animate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 253 KiB |
BIN
tests/components/generic/sample2_jpeg_odd_header.jpg
Normal file
BIN
tests/components/generic/sample2_jpeg_odd_header.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
BIN
tests/components/generic/sample3_jpeg_odd_header.jpg
Normal file
BIN
tests/components/generic/sample3_jpeg_odd_header.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 172 KiB |
BIN
tests/components/generic/sample4_K5-60mileAnim-320x240.gif
Normal file
BIN
tests/components/generic/sample4_K5-60mileAnim-320x240.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
@ -1,6 +1,7 @@
|
|||||||
"""Test The generic (IP Camera) config flow."""
|
"""Test The generic (IP Camera) config flow."""
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
|
import os.path
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import av
|
import av
|
||||||
@ -137,6 +138,30 @@ async def test_form_only_svg_whitespace(hass, fakeimgbytes_svg, user_flow):
|
|||||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
|
|
||||||
|
|
||||||
|
@respx.mock
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"image_file",
|
||||||
|
[
|
||||||
|
("sample1_animate.png"),
|
||||||
|
("sample2_jpeg_odd_header.jpg"),
|
||||||
|
("sample3_jpeg_odd_header.jpg"),
|
||||||
|
("sample4_K5-60mileAnim-320x240.gif"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
async def test_form_only_still_sample(hass, user_flow, image_file):
|
||||||
|
"""Test various sample images #69037."""
|
||||||
|
image_path = os.path.join(os.path.dirname(__file__), image_file)
|
||||||
|
with open(image_path, "rb") as image:
|
||||||
|
respx.get("http://127.0.0.1/testurl/1").respond(stream=image.read())
|
||||||
|
data = TESTDATA.copy()
|
||||||
|
data.pop(CONF_STREAM_SOURCE)
|
||||||
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
|
user_flow["flow_id"],
|
||||||
|
data,
|
||||||
|
)
|
||||||
|
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
|
|
||||||
|
|
||||||
@respx.mock
|
@respx.mock
|
||||||
async def test_form_rtsp_mode(hass, fakeimg_png, mock_av_open, user_flow):
|
async def test_form_rtsp_mode(hass, fakeimg_png, mock_av_open, user_flow):
|
||||||
"""Test we complete ok if the user enters a stream url."""
|
"""Test we complete ok if the user enters a stream url."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user