+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/vesync/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
2 changes: 1 addition & 1 deletion requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 28 additions & 3 deletions tests/components/vesync/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

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
Expand Down Expand Up @@ -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,
):
Expand All @@ -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."""
Expand Down
2 changes: 0 additions & 2 deletions tests/components/vesync/snapshots/test_diagnostics.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
'device_status': 'on',
'device_type': 'Classic200S',
'display': 'Method',
'displayJSON': 'Method',
'enabled': 'Method',
'features': list([
'night_light',
Expand Down Expand Up @@ -173,7 +172,6 @@
'device_status': 'on',
'device_type': 'fan',
'display': 'Method',
'displayJSON': 'Method',
'enabled': 'Method',
'fan_levels': 'Method',
'features': 'Method',
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载