From ad1a71ebc36599c7a0777e4e3fc1e229c3977531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 14 Sep 2020 09:40:59 +0300 Subject: [PATCH] Don't try to create /test dir in camera tests (#39914) ERROR:homeassistant.components.camera: Can't write image to file: [Errno 13] Permission denied: '/test' --- tests/components/camera/test_init.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/components/camera/test_init.py b/tests/components/camera/test_init.py index c3db5067b1f..966adc97b67 100644 --- a/tests/components/camera/test_init.py +++ b/tests/components/camera/test_init.py @@ -14,7 +14,7 @@ from homeassistant.const import ATTR_ENTITY_ID, EVENT_HOMEASSISTANT_START from homeassistant.exceptions import HomeAssistantError from homeassistant.setup import async_setup_component -from tests.async_mock import PropertyMock, mock_open, patch +from tests.async_mock import Mock, PropertyMock, mock_open, patch from tests.components.camera import common @@ -114,8 +114,9 @@ async def test_snapshot_service(hass, mock_camera): """Test snapshot service.""" mopen = mock_open() - with patch( - "homeassistant.components.camera.open", mopen, create=True + with patch("homeassistant.components.camera.open", mopen, create=True), patch( + "homeassistant.components.camera.os.path.exists", + Mock(spec="os.path.exists", return_value=True), ), patch.object(hass.config, "is_allowed_path", return_value=True): await hass.services.async_call( camera.DOMAIN,