mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Avoid naive datetime.now() in smarttub tests (#178036)
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
f310afbfde
commit
de194a6cef
@@ -1,6 +1,5 @@
|
||||
"""Test the SmartTub binary sensor platform."""
|
||||
|
||||
from datetime import datetime
|
||||
from unittest.mock import create_autospec
|
||||
|
||||
import pytest
|
||||
@@ -8,6 +7,7 @@ import smarttub
|
||||
|
||||
from homeassistant.components.binary_sensor import STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
|
||||
async def test_binary_sensors(spa, setup_entry, hass: HomeAssistant) -> None:
|
||||
@@ -43,8 +43,8 @@ def mock_error(spa):
|
||||
error.title = "Flow Switch Stuck Open"
|
||||
error.description = None
|
||||
error.active = True
|
||||
error.created_at = datetime.now() # pylint: disable=home-assistant-enforce-naive-now
|
||||
error.updated_at = datetime.now() # pylint: disable=home-assistant-enforce-naive-now
|
||||
error.created_at = dt_util.utcnow()
|
||||
error.updated_at = dt_util.utcnow()
|
||||
error.error_type = "TUB_ERROR"
|
||||
return error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user