From dd0c353afbb1282da55f061c89910a8edf1a823e Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Tue, 27 Aug 2024 22:28:54 +0200 Subject: [PATCH] Fix nice_go integration tests (#124736) --- tests/components/nice_go/conftest.py | 3 ++- tests/components/nice_go/snapshots/test_diagnostics.ambr | 1 - tests/components/nice_go/test_diagnostics.py | 4 +++- tests/components/nice_go/test_init.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/components/nice_go/conftest.py b/tests/components/nice_go/conftest.py index 31b21083c05..9ed3d0d19cf 100644 --- a/tests/components/nice_go/conftest.py +++ b/tests/components/nice_go/conftest.py @@ -1,6 +1,7 @@ """Common fixtures for the Nice G.O. tests.""" from collections.abc import Generator +from datetime import datetime from unittest.mock import AsyncMock, patch from nice_go import Barrier, BarrierState, ConnectionState @@ -71,7 +72,7 @@ def mock_config_entry() -> MockConfigEntry: CONF_EMAIL: "test-email", CONF_PASSWORD: "test-password", CONF_REFRESH_TOKEN: "test-refresh-token", - CONF_REFRESH_TOKEN_CREATION_TIME: 1722184160.738171, + CONF_REFRESH_TOKEN_CREATION_TIME: datetime.now().timestamp(), }, version=1, unique_id="test-email", diff --git a/tests/components/nice_go/snapshots/test_diagnostics.ambr b/tests/components/nice_go/snapshots/test_diagnostics.ambr index abd3b3103d1..6f9428ed246 100644 --- a/tests/components/nice_go/snapshots/test_diagnostics.ambr +++ b/tests/components/nice_go/snapshots/test_diagnostics.ambr @@ -26,7 +26,6 @@ 'email': '**REDACTED**', 'password': '**REDACTED**', 'refresh_token': '**REDACTED**', - 'refresh_token_creation_time': 1722184160.738171, }), 'disabled_by': None, 'domain': 'nice_go', diff --git a/tests/components/nice_go/test_diagnostics.py b/tests/components/nice_go/test_diagnostics.py index 1c88c6a8dc6..f91f5748792 100644 --- a/tests/components/nice_go/test_diagnostics.py +++ b/tests/components/nice_go/test_diagnostics.py @@ -26,4 +26,6 @@ async def test_entry_diagnostics( result = await get_diagnostics_for_config_entry( hass, hass_client, mock_config_entry ) - assert result == snapshot(exclude=props("created_at", "modified_at")) + assert result == snapshot( + exclude=props("created_at", "modified_at", "refresh_token_creation_time") + ) diff --git a/tests/components/nice_go/test_init.py b/tests/components/nice_go/test_init.py index 249622d23b0..5568a7ea62a 100644 --- a/tests/components/nice_go/test_init.py +++ b/tests/components/nice_go/test_init.py @@ -110,7 +110,7 @@ async def test_update_refresh_token( assert mock_nice_go.authenticate.call_count == 0 mock_nice_go.authenticate.return_value = "new-refresh-token" - freezer.tick(timedelta(days=30)) + freezer.tick(timedelta(days=30, seconds=1)) async_fire_time_changed(hass) assert await hass.config_entries.async_reload(mock_config_entry.entry_id) await hass.async_block_till_done()