diff --git a/homeassistant/components/vesync/manifest.json b/homeassistant/components/vesync/manifest.json index 6ea7edd13d5..8749dd956ff 100644 --- a/homeassistant/components/vesync/manifest.json +++ b/homeassistant/components/vesync/manifest.json @@ -13,5 +13,5 @@ "documentation": "https://www.home-assistant.io/integrations/vesync", "iot_class": "cloud_polling", "loggers": ["pyvesync"], - "requirements": ["pyvesync==3.0.0"] + "requirements": ["pyvesync==3.1.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index 8424ce4daf5..520dbe29406 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2611,7 +2611,7 @@ pyvera==0.3.16 pyversasense==0.0.6 # homeassistant.components.vesync -pyvesync==3.0.0 +pyvesync==3.1.0 # homeassistant.components.vizio pyvizio==0.1.61 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 64c60b43426..eb1ba0f58e3 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2169,7 +2169,7 @@ pyuptimerobot==22.2.0 pyvera==0.3.16 # homeassistant.components.vesync -pyvesync==3.0.0 +pyvesync==3.1.0 # homeassistant.components.vizio pyvizio==0.1.61 diff --git a/tests/components/vesync/conftest.py b/tests/components/vesync/conftest.py index faaefb2ed82..8b15e7c76d3 100644 --- a/tests/components/vesync/conftest.py +++ b/tests/components/vesync/conftest.py @@ -10,6 +10,7 @@ from unittest.mock import AsyncMock, MagicMock, Mock, PropertyMock, patch import pytest from pyvesync import VeSync +from pyvesync.auth import VeSyncAuth from pyvesync.base_devices.bulb_base import VeSyncBulb from pyvesync.base_devices.fan_base import VeSyncFanBase from pyvesync.base_devices.humidifier_base import HumidifierState @@ -51,15 +52,12 @@ def patch_vesync(): """Patch VeSync methods and several properties/attributes for all tests.""" props = { "enabled": True, - "token": "TEST_TOKEN", - "account_id": "TEST_ACCOUNT_ID", } with ( patch.multiple( "pyvesync.vesync.VeSync", check_firmware=AsyncMock(return_value=True), - login=AsyncMock(return_value=None), ), ExitStack() as stack, ): @@ -71,6 +69,33 @@ def patch_vesync(): yield +@pytest.fixture(autouse=True) +def patch_vesync_auth(): + """Patch VeSync Auth methods and several properties/attributes for all tests.""" + props = { + "_token": "TESTTOKEN", + "_account_id": "TESTACCOUNTID", + "_country_code": "US", + "_current_region": "US", + "_username": "TESTUSERNAME", + "_password": "TESTPASSWORD", + } + + with ( + patch.multiple( + "pyvesync.auth.VeSyncAuth", + login=AsyncMock(return_value=True), + ), + ExitStack() as stack, + ): + for name, value in props.items(): + mock = stack.enter_context( + patch.object(VeSyncAuth, name, new_callable=PropertyMock) + ) + mock.return_value = value + yield + + @pytest.fixture(name="config_entry") def config_entry_fixture(hass: HomeAssistant, config) -> ConfigEntry: """Create a mock VeSync config entry.""" diff --git a/tests/components/vesync/snapshots/test_diagnostics.ambr b/tests/components/vesync/snapshots/test_diagnostics.ambr index 7b6c8a2899d..3f01ce765b9 100644 --- a/tests/components/vesync/snapshots/test_diagnostics.ambr +++ b/tests/components/vesync/snapshots/test_diagnostics.ambr @@ -53,7 +53,6 @@ 'device_status': 'on', 'device_type': 'Classic200S', 'display': 'Method', - 'displayJSON': 'Method', 'enabled': 'Method', 'features': list([ 'night_light', @@ -173,7 +172,6 @@ 'device_status': 'on', 'device_type': 'fan', 'display': 'Method', - 'displayJSON': 'Method', 'enabled': 'Method', 'fan_levels': 'Method', 'features': 'Method',