Files
esphome/tests/component_tests/tuya/test_init.py
T
1402cb7b64 [tuya] Add forced minute boundary time sync (#18603)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-10-11 00:32:39 -10:00

24 lines
660 B
Python

"""Tests for Tuya time synchronization configuration validation."""
import pytest
from esphome import config_validation as cv
from esphome.components.tuya import CONF_FORCE_TIME_SYNC, CONFIG_SCHEMA
from esphome.const import CONF_TIME_ID
def test_force_time_sync_accepts_time_id() -> None:
config = CONFIG_SCHEMA(
{
CONF_FORCE_TIME_SYNC: True,
CONF_TIME_ID: "tuya_time",
}
)
assert config[CONF_FORCE_TIME_SYNC] is True
def test_force_time_sync_requires_time_id() -> None:
with pytest.raises(cv.Invalid, match="force_time_sync requires time_id"):
CONFIG_SCHEMA({CONF_FORCE_TIME_SYNC: True})