1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Use pytest.mark.freeze_time in ntfy tests (#156336)

This commit is contained in:
Erik Montnemery
2025-11-11 09:33:21 +01:00
committed by GitHub
parent 5cd5d480d9
commit 02ff5de1ff
3 changed files with 5 additions and 6 deletions

View File

@@ -52,7 +52,7 @@
'event_types': list([
'Title: Hello',
]),
'expires': datetime.datetime(2025, 3, 29, 5, 58, 46, tzinfo=datetime.timezone.utc),
'expires': HAFakeDatetime(2025, 3, 29, 5, 58, 46, tzinfo=datetime.timezone.utc),
'friendly_name': 'mytopic',
'icon': 'https://example.com/icon.png',
'id': 'h6Y2hKA5sy0U',
@@ -61,7 +61,7 @@
'tags': list([
'octopus',
]),
'time': datetime.datetime(2025, 3, 28, 17, 58, 46, tzinfo=datetime.timezone.utc),
'time': HAFakeDatetime(2025, 3, 28, 17, 58, 46, tzinfo=datetime.timezone.utc),
'title': 'Title',
'topic': 'mytopic',
}),

View File

@@ -13,7 +13,7 @@ from aiontfy.exceptions import (
NtfyTimeoutError,
NtfyUnauthorizedAuthenticationError,
)
from freezegun.api import FrozenDateTimeFactory, freeze_time
from freezegun.api import FrozenDateTimeFactory
import pytest
from syrupy.assertion import SnapshotAssertion
@@ -44,7 +44,7 @@ async def event_only() -> AsyncGenerator[None]:
@pytest.mark.usefixtures("mock_aiontfy")
@freeze_time("2025-09-03T22:00:00.000Z")
@pytest.mark.freeze_time("2025-09-03T22:00:00.000Z")
async def test_event_platform(
hass: HomeAssistant,
config_entry: MockConfigEntry,

View File

@@ -9,7 +9,6 @@ from aiontfy.exceptions import (
NtfyHTTPError,
NtfyUnauthorizedAuthenticationError,
)
from freezegun.api import freeze_time
import pytest
from syrupy.assertion import SnapshotAssertion
@@ -57,7 +56,7 @@ async def test_notify_platform(
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
@freeze_time("2025-01-09T12:00:00+00:00")
@pytest.mark.freeze_time("2025-01-09T12:00:00+00:00")
async def test_send_message(
hass: HomeAssistant,
config_entry: MockConfigEntry,