mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +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."""
|
||||
|
||||
import errno
|
||||
import os.path
|
||||
from unittest.mock import patch
|
||||
|
||||
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
|
||||
|
||||
|
||||
@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
|
||||
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."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user