mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 18:57:57 +00:00
Bump nyt_games to 0.4.2 (#126834)
* Bump nyt_games to 0.4.1 * Bump nyt_games to 0.4.1 * Bump nyt_games to 0.4.2
This commit is contained in:
parent
1380ed7328
commit
dd0fc0688d
@ -22,7 +22,7 @@ class NYTGamesData:
|
|||||||
"""Class for NYT Games data."""
|
"""Class for NYT Games data."""
|
||||||
|
|
||||||
wordle: Wordle
|
wordle: Wordle
|
||||||
spelling_bee: SpellingBee
|
spelling_bee: SpellingBee | None
|
||||||
connections: Connections
|
connections: Connections
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/nyt_games",
|
"documentation": "https://www.home-assistant.io/integrations/nyt_games",
|
||||||
"integration_type": "service",
|
"integration_type": "service",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"requirements": ["nyt_games==0.4.0"]
|
"requirements": ["nyt_games==0.4.2"]
|
||||||
}
|
}
|
||||||
|
@ -156,10 +156,11 @@ async def async_setup_entry(
|
|||||||
entities: list[SensorEntity] = [
|
entities: list[SensorEntity] = [
|
||||||
NYTGamesWordleSensor(coordinator, description) for description in WORDLE_SENSORS
|
NYTGamesWordleSensor(coordinator, description) for description in WORDLE_SENSORS
|
||||||
]
|
]
|
||||||
entities.extend(
|
if coordinator.data.spelling_bee is not None:
|
||||||
NYTGamesSpellingBeeSensor(coordinator, description)
|
entities.extend(
|
||||||
for description in SPELLING_BEE_SENSORS
|
NYTGamesSpellingBeeSensor(coordinator, description)
|
||||||
)
|
for description in SPELLING_BEE_SENSORS
|
||||||
|
)
|
||||||
entities.extend(
|
entities.extend(
|
||||||
NYTGamesConnectionsSensor(coordinator, description)
|
NYTGamesConnectionsSensor(coordinator, description)
|
||||||
for description in CONNECTIONS_SENSORS
|
for description in CONNECTIONS_SENSORS
|
||||||
@ -211,6 +212,7 @@ class NYTGamesSpellingBeeSensor(SpellingBeeEntity, SensorEntity):
|
|||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
|
assert self.coordinator.data.spelling_bee is not None
|
||||||
return self.entity_description.value_fn(self.coordinator.data.spelling_bee)
|
return self.entity_description.value_fn(self.coordinator.data.spelling_bee)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1484,7 +1484,7 @@ numato-gpio==0.13.0
|
|||||||
numpy==1.26.4
|
numpy==1.26.4
|
||||||
|
|
||||||
# homeassistant.components.nyt_games
|
# homeassistant.components.nyt_games
|
||||||
nyt_games==0.4.0
|
nyt_games==0.4.2
|
||||||
|
|
||||||
# homeassistant.components.oasa_telematics
|
# homeassistant.components.oasa_telematics
|
||||||
oasatelematics==0.3
|
oasatelematics==0.3
|
||||||
|
@ -1232,7 +1232,7 @@ numato-gpio==0.13.0
|
|||||||
numpy==1.26.4
|
numpy==1.26.4
|
||||||
|
|
||||||
# homeassistant.components.nyt_games
|
# homeassistant.components.nyt_games
|
||||||
nyt_games==0.4.0
|
nyt_games==0.4.2
|
||||||
|
|
||||||
# homeassistant.components.google
|
# homeassistant.components.google
|
||||||
oauth2client==4.1.3
|
oauth2client==4.1.3
|
||||||
|
51
tests/components/nyt_games/fixtures/new_account.json
Normal file
51
tests/components/nyt_games/fixtures/new_account.json
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"states": [],
|
||||||
|
"user_id": 260705259,
|
||||||
|
"player": {
|
||||||
|
"user_id": 260705259,
|
||||||
|
"last_updated": 1727358123,
|
||||||
|
"stats": {
|
||||||
|
"wordle": {
|
||||||
|
"legacyStats": {
|
||||||
|
"gamesPlayed": 1,
|
||||||
|
"gamesWon": 1,
|
||||||
|
"guesses": {
|
||||||
|
"1": 0,
|
||||||
|
"2": 0,
|
||||||
|
"3": 0,
|
||||||
|
"4": 0,
|
||||||
|
"5": 1,
|
||||||
|
"6": 0,
|
||||||
|
"fail": 0
|
||||||
|
},
|
||||||
|
"currentStreak": 0,
|
||||||
|
"maxStreak": 1,
|
||||||
|
"lastWonDayOffset": 1118,
|
||||||
|
"hasPlayed": true,
|
||||||
|
"autoOptInTimestamp": 1727357874700,
|
||||||
|
"hasMadeStatsChoice": false,
|
||||||
|
"timestamp": 1727358123
|
||||||
|
},
|
||||||
|
"calculatedStats": {
|
||||||
|
"gamesPlayed": 0,
|
||||||
|
"gamesWon": 0,
|
||||||
|
"guesses": {
|
||||||
|
"1": 0,
|
||||||
|
"2": 0,
|
||||||
|
"3": 0,
|
||||||
|
"4": 0,
|
||||||
|
"5": 0,
|
||||||
|
"6": 0,
|
||||||
|
"fail": 0
|
||||||
|
},
|
||||||
|
"currentStreak": 0,
|
||||||
|
"maxStreak": 1,
|
||||||
|
"lastWonPrintDate": "",
|
||||||
|
"lastCompletedPrintDate": "",
|
||||||
|
"hasPlayed": false,
|
||||||
|
"generation": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -547,7 +547,7 @@
|
|||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_reported': <ANY>,
|
'last_reported': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': '33',
|
'state': '70',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
# name: test_all_entities[sensor.wordle_won-entry]
|
# name: test_all_entities[sensor.wordle_won-entry]
|
||||||
@ -597,6 +597,6 @@
|
|||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_reported': <ANY>,
|
'last_reported': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': '26',
|
'state': '51',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
@ -4,17 +4,23 @@ from datetime import timedelta
|
|||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
from nyt_games import NYTGamesError
|
from nyt_games import NYTGamesError, WordleStats
|
||||||
import pytest
|
import pytest
|
||||||
from syrupy import SnapshotAssertion
|
from syrupy import SnapshotAssertion
|
||||||
|
|
||||||
|
from homeassistant.components.nyt_games.const import DOMAIN
|
||||||
from homeassistant.const import STATE_UNAVAILABLE
|
from homeassistant.const import STATE_UNAVAILABLE
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from . import setup_integration
|
from . import setup_integration
|
||||||
|
|
||||||
from tests.common import MockConfigEntry, async_fire_time_changed, snapshot_platform
|
from tests.common import (
|
||||||
|
MockConfigEntry,
|
||||||
|
async_fire_time_changed,
|
||||||
|
load_fixture,
|
||||||
|
snapshot_platform,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||||
@ -55,3 +61,17 @@ async def test_updating_exception(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert hass.states.get("sensor.wordle_played").state != STATE_UNAVAILABLE
|
assert hass.states.get("sensor.wordle_played").state != STATE_UNAVAILABLE
|
||||||
|
|
||||||
|
|
||||||
|
async def test_new_account(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
mock_nyt_games_client: AsyncMock,
|
||||||
|
mock_config_entry: MockConfigEntry,
|
||||||
|
) -> None:
|
||||||
|
"""Test handling an exception during update."""
|
||||||
|
mock_nyt_games_client.get_latest_stats.return_value = WordleStats.from_json(
|
||||||
|
load_fixture("new_account.json", DOMAIN)
|
||||||
|
).player.stats
|
||||||
|
await setup_integration(hass, mock_config_entry)
|
||||||
|
|
||||||
|
assert hass.states.get("sensor.spelling_bee_played") is None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user