Skip to content

Commit

Permalink
add api do not return webcam list test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcolivierarsenault committed Nov 26, 2023
1 parent 213e2e6 commit e1057d2
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async def test_setup_thumbnail_camera(hass, get_data):
assert entry is not None


async def test_hardcoded_camera(hass, get_default_api_response):
async def test_hardcoded_camera_empty_list(hass, get_default_api_response):
"""Test hardcoded camera"""
get_default_api_response["webcams"] = []

Expand All @@ -129,6 +129,21 @@ async def test_hardcoded_camera(hass, get_default_api_response):
assert entry is not None


async def test_hardcoded_camera_API_error(hass, get_default_api_response):
"""Test hardcoded camera"""
get_default_api_response["webcams"] = None

config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
await hass.async_block_till_done()

entity_registry = er.async_get(hass)
entry = entity_registry.async_get("camera.mainsail_webcam")

assert entry is not None


async def test_thumbnail_camera_image(
hass, aioclient_mock, get_data, _moonraker_default_mock
):
Expand Down

0 comments on commit e1057d2

Please sign in to comment.