Upgrade wled 0.4.1 (#36091)

This commit is contained in:
Franck Nijhof 2020-06-03 02:29:49 +02:00 committed by GitHub
parent 94a9b364b0
commit d2e6b863b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 24 deletions

View file

@ -3,7 +3,7 @@
"name": "WLED",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/wled",
"requirements": ["wled==0.3.0"],
"requirements": ["wled==0.4.1"],
"zeroconf": ["_wled._tcp.local."],
"codeowners": ["@frenck"],
"quality_scale": "platinum"

View file

@ -2195,7 +2195,7 @@ wirelesstagpy==0.4.0
withings-api==2.1.3
# homeassistant.components.wled
wled==0.3.0
wled==0.4.1
# homeassistant.components.xbee
xbee-helper==0.0.7

View file

@ -898,7 +898,7 @@ wiffi==1.0.0
withings-api==2.1.3
# homeassistant.components.wled
wled==0.3.0
wled==0.4.1
# homeassistant.components.bluesound
# homeassistant.components.rest

View file

@ -1,5 +1,7 @@
"""Tests for the WLED integration."""
import json
from homeassistant.components.wled.const import DOMAIN
from homeassistant.const import CONF_HOST, CONF_MAC
from homeassistant.core import HomeAssistant
@ -17,27 +19,29 @@ async def init_integration(
"""Set up the WLED integration in Home Assistant."""
fixture = "wled/rgb.json" if not rgbw else "wled/rgbw.json"
data = json.loads(load_fixture(fixture))
aioclient_mock.get(
"http://192.168.1.123:80/json/",
text=load_fixture(fixture),
json=data,
headers={"Content-Type": "application/json"},
)
aioclient_mock.post(
"http://192.168.1.123:80/json/state",
json={},
json=data["state"],
headers={"Content-Type": "application/json"},
)
aioclient_mock.get(
"http://192.168.1.123:80/json/info",
json={},
json=data["info"],
headers={"Content-Type": "application/json"},
)
aioclient_mock.get(
"http://192.168.1.123:80/json/state",
json={},
json=data["state"],
headers={"Content-Type": "application/json"},
)

View file

@ -1,5 +1,6 @@
"""Tests for the WLED config flow."""
import aiohttp
from wled import WLEDConnectionError
from homeassistant import data_entry_flow
from homeassistant.components.wled import config_flow
@ -9,6 +10,7 @@ from homeassistant.core import HomeAssistant
from . import init_integration
from tests.async_mock import MagicMock, patch
from tests.common import load_fixture
from tests.test_util.aiohttp import AiohttpClientMocker
@ -59,8 +61,9 @@ async def test_show_zerconf_form(
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
@patch("homeassistant.components.wled.WLED.update", side_effect=WLEDConnectionError)
async def test_connection_error(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
update_mock: MagicMock, hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test we show user form on WLED connection error."""
aioclient_mock.get("http://example.com/json/", exc=aiohttp.ClientError)
@ -76,8 +79,9 @@ async def test_connection_error(
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
@patch("homeassistant.components.wled.WLED.update", side_effect=WLEDConnectionError)
async def test_zeroconf_connection_error(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
update_mock: MagicMock, hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test we abort zeroconf flow on WLED connection error."""
aioclient_mock.get("http://192.168.1.123/json/", exc=aiohttp.ClientError)
@ -92,8 +96,9 @@ async def test_zeroconf_connection_error(
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
@patch("homeassistant.components.wled.WLED.update", side_effect=WLEDConnectionError)
async def test_zeroconf_confirm_connection_error(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
update_mock: MagicMock, hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test we abort zeroconf flow on WLED connection error."""
aioclient_mock.get("http://192.168.1.123:80/json/", exc=aiohttp.ClientError)
@ -112,8 +117,9 @@ async def test_zeroconf_confirm_connection_error(
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
@patch("homeassistant.components.wled.WLED.update", side_effect=WLEDConnectionError)
async def test_zeroconf_no_data(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
update_mock: MagicMock, hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test we abort if zeroconf provides no data."""
flow = config_flow.WLEDFlowHandler()

View file

@ -1,20 +1,20 @@
"""Tests for the WLED integration."""
import aiohttp
from wled import WLEDConnectionError
from homeassistant.components.wled.const import DOMAIN
from homeassistant.config_entries import ENTRY_STATE_SETUP_RETRY
from homeassistant.core import HomeAssistant
from tests.async_mock import MagicMock, patch
from tests.components.wled import init_integration
from tests.test_util.aiohttp import AiohttpClientMocker
@patch("homeassistant.components.wled.WLED.update", side_effect=WLEDConnectionError)
async def test_config_entry_not_ready(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
mock_update: MagicMock, hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the WLED configuration entry not ready."""
aioclient_mock.get("http://192.168.1.123:80/json/", exc=aiohttp.ClientError)
entry = await init_integration(hass, aioclient_mock)
assert entry.state == ENTRY_STATE_SETUP_RETRY

View file

@ -1,5 +1,5 @@
"""Tests for the WLED light platform."""
import aiohttp
from wled import WLEDConnectionError
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
@ -144,7 +144,7 @@ async def test_light_error(
aioclient_mock.post("http://192.168.1.123:80/json/state", text="", status=400)
await init_integration(hass, aioclient_mock)
with patch("homeassistant.components.wled.WLEDDataUpdateCoordinator.async_refresh"):
with patch("homeassistant.components.wled.WLED.update"):
await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_OFF,
@ -162,10 +162,11 @@ async def test_light_connection_error(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test error handling of the WLED switches."""
aioclient_mock.post("http://192.168.1.123:80/json/state", exc=aiohttp.ClientError)
await init_integration(hass, aioclient_mock)
with patch("homeassistant.components.wled.WLEDDataUpdateCoordinator.async_refresh"):
with patch("homeassistant.components.wled.WLED.update"), patch(
"homeassistant.components.wled.WLED.light", side_effect=WLEDConnectionError
):
await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_OFF,
@ -342,7 +343,7 @@ async def test_effect_service_error(
aioclient_mock.post("http://192.168.1.123:80/json/state", text="", status=400)
await init_integration(hass, aioclient_mock)
with patch("homeassistant.components.wled.WLEDDataUpdateCoordinator.async_refresh"):
with patch("homeassistant.components.wled.WLED.update"):
await hass.services.async_call(
DOMAIN,
SERVICE_EFFECT,

View file

@ -1,5 +1,5 @@
"""Tests for the WLED switch platform."""
import aiohttp
from wled import WLEDConnectionError
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.components.wled.const import (
@ -142,7 +142,7 @@ async def test_switch_error(
aioclient_mock.post("http://192.168.1.123:80/json/state", text="", status=400)
await init_integration(hass, aioclient_mock)
with patch("homeassistant.components.wled.WLEDDataUpdateCoordinator.async_refresh"):
with patch("homeassistant.components.wled.WLED.update"):
await hass.services.async_call(
SWITCH_DOMAIN,
SERVICE_TURN_ON,
@ -160,10 +160,11 @@ async def test_switch_connection_error(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test error handling of the WLED switches."""
aioclient_mock.post("http://192.168.1.123:80/json/state", exc=aiohttp.ClientError)
await init_integration(hass, aioclient_mock)
with patch("homeassistant.components.wled.WLEDDataUpdateCoordinator.async_refresh"):
with patch("homeassistant.components.wled.WLED.update"), patch(
"homeassistant.components.wled.WLED.nightlight", side_effect=WLEDConnectionError
):
await hass.services.async_call(
SWITCH_DOMAIN,
SERVICE_TURN_ON,