From 089a3ab6d71e2920c2e5e79afd66ec1c7d3cab29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mind=C3=AAllo=20de=20Andrade?= Date: Tue, 19 Mar 2024 04:50:11 -0300 Subject: [PATCH] Bump sunweg to 2.1.1 (#113767) --- homeassistant/components/sunweg/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/sunweg/conftest.py | 20 +++++++++++++++++++ tests/components/sunweg/test_init.py | 16 +++++++++++++++ 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/sunweg/manifest.json b/homeassistant/components/sunweg/manifest.json index b681ecc6d5f..3e41d331e8c 100644 --- a/homeassistant/components/sunweg/manifest.json +++ b/homeassistant/components/sunweg/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/sunweg/", "iot_class": "cloud_polling", "loggers": ["sunweg"], - "requirements": ["sunweg==2.1.0"] + "requirements": ["sunweg==2.1.1"] } diff --git a/requirements_all.txt b/requirements_all.txt index 6640155c623..256055c801c 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2631,7 +2631,7 @@ subarulink==0.7.9 sunwatcher==0.2.1 # homeassistant.components.sunweg -sunweg==2.1.0 +sunweg==2.1.1 # homeassistant.components.surepetcare surepy==0.9.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 34df50d9eb9..d2cc004fc32 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2032,7 +2032,7 @@ subarulink==0.7.9 sunwatcher==0.2.1 # homeassistant.components.sunweg -sunweg==2.1.0 +sunweg==2.1.1 # homeassistant.components.surepetcare surepy==0.9.0 diff --git a/tests/components/sunweg/conftest.py b/tests/components/sunweg/conftest.py index 68c4cab86c5..db94b9cc5c8 100644 --- a/tests/components/sunweg/conftest.py +++ b/tests/components/sunweg/conftest.py @@ -68,3 +68,23 @@ def plant_fixture(inverter_fixture) -> Plant: ) plant.inverters.append(inverter_fixture) return plant + + +@pytest.fixture +def plant_fixture_alternative(inverter_fixture) -> Plant: + """Define Plant fixture.""" + plant = Plant( + 123456, + "Plant #123", + 29.5, + 0.5, + 0, + 12.786912, + 24.0, + "kWh", + 332.2, + 0.012296, + None, + ) + plant.inverters.append(inverter_fixture) + return plant diff --git a/tests/components/sunweg/test_init.py b/tests/components/sunweg/test_init.py index 0295e778f9c..5707fd93b99 100644 --- a/tests/components/sunweg/test_init.py +++ b/tests/components/sunweg/test_init.py @@ -76,6 +76,22 @@ async def test_sunwegdata_update_success(plant_fixture) -> None: assert len(data.data.inverters) == 1 +async def test_sunwegdata_update_success_alternative(plant_fixture_alternative) -> None: + """Test SunWEGData success on update.""" + api = MagicMock() + api.plant = MagicMock(return_value=plant_fixture_alternative) + api.complete_inverter = MagicMock() + data = SunWEGData(api, 0) + data.update() + assert data.data.id == plant_fixture_alternative.id + assert data.data.name == plant_fixture_alternative.name + assert data.data.kwh_per_kwp == plant_fixture_alternative.kwh_per_kwp + assert data.data.last_update == plant_fixture_alternative.last_update + assert data.data.performance_rate == plant_fixture_alternative.performance_rate + assert data.data.saving == plant_fixture_alternative.saving + assert len(data.data.inverters) == 1 + + async def test_sunwegdata_get_api_value_none(plant_fixture) -> None: """Test SunWEGData none return on get_api_value.""" api = MagicMock()