Skip to content
Snippets Groups Projects
Unverified Commit dd0c353a authored by Jan Bouwhuis's avatar Jan Bouwhuis Committed by GitHub
Browse files

Fix nice_go integration tests (#124736)

parent 9e762fa2
No related branches found
No related tags found
No related merge requests found
"""Common fixtures for the Nice G.O. tests.""" """Common fixtures for the Nice G.O. tests."""
from collections.abc import Generator from collections.abc import Generator
from datetime import datetime
from unittest.mock import AsyncMock, patch from unittest.mock import AsyncMock, patch
from nice_go import Barrier, BarrierState, ConnectionState from nice_go import Barrier, BarrierState, ConnectionState
...@@ -71,7 +72,7 @@ def mock_config_entry() -> MockConfigEntry: ...@@ -71,7 +72,7 @@ def mock_config_entry() -> MockConfigEntry:
CONF_EMAIL: "test-email", CONF_EMAIL: "test-email",
CONF_PASSWORD: "test-password", CONF_PASSWORD: "test-password",
CONF_REFRESH_TOKEN: "test-refresh-token", CONF_REFRESH_TOKEN: "test-refresh-token",
CONF_REFRESH_TOKEN_CREATION_TIME: 1722184160.738171, CONF_REFRESH_TOKEN_CREATION_TIME: datetime.now().timestamp(),
}, },
version=1, version=1,
unique_id="test-email", unique_id="test-email",
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
'email': '**REDACTED**', 'email': '**REDACTED**',
'password': '**REDACTED**', 'password': '**REDACTED**',
'refresh_token': '**REDACTED**', 'refresh_token': '**REDACTED**',
'refresh_token_creation_time': 1722184160.738171,
}), }),
'disabled_by': None, 'disabled_by': None,
'domain': 'nice_go', 'domain': 'nice_go',
......
...@@ -26,4 +26,6 @@ async def test_entry_diagnostics( ...@@ -26,4 +26,6 @@ async def test_entry_diagnostics(
result = await get_diagnostics_for_config_entry( result = await get_diagnostics_for_config_entry(
hass, hass_client, mock_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")
)
...@@ -110,7 +110,7 @@ async def test_update_refresh_token( ...@@ -110,7 +110,7 @@ async def test_update_refresh_token(
assert mock_nice_go.authenticate.call_count == 0 assert mock_nice_go.authenticate.call_count == 0
mock_nice_go.authenticate.return_value = "new-refresh-token" 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) async_fire_time_changed(hass)
assert await hass.config_entries.async_reload(mock_config_entry.entry_id) assert await hass.config_entries.async_reload(mock_config_entry.entry_id)
await hass.async_block_till_done() await hass.async_block_till_done()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment