File tree Expand file tree Collapse file tree 3 files changed +14
-19
lines changed
homeassistant/components/eveonline
tests/components/eveonline Expand file tree Collapse file tree 3 files changed +14
-19
lines changed Original file line number Diff line number Diff line change 99
1010from homeassistant .exceptions import (
1111 ConfigEntryAuthFailed ,
12- ConfigEntryNotReady ,
1312 OAuth2TokenRequestReauthError ,
1413 OAuth2TokenRequestTransientError ,
1514)
1615from homeassistant .helpers .config_entry_oauth2_flow import OAuth2Session
16+ from homeassistant .helpers .update_coordinator import UpdateFailed
1717
1818from .const import DOMAIN
1919
@@ -40,7 +40,7 @@ async def async_get_access_token(self) -> str:
4040 translation_key = "authentication_failed" ,
4141 ) from err
4242 except (OAuth2TokenRequestTransientError , ClientError ) as err :
43- raise ConfigEntryNotReady (
43+ raise UpdateFailed (
4444 translation_domain = DOMAIN ,
4545 translation_key = "token_refresh_failed" ,
4646 translation_placeholders = {"error" : str (err )},
Original file line number Diff line number Diff line change @@ -164,20 +164,10 @@ async def async_setup_entry(
164164 )
165165
166166
167- class EveOnlineSensor ( SensorEntity ):
168- """Base class for Eve Online sensors ."""
167+ class EveOnlineCharacterSensor ( EveOnlineCharacterEntity , SensorEntity ):
168+ """Eve Online character sensor (per-character device) ."""
169169
170170 entity_description : EveOnlineSensorDescription
171- coordinator : EveOnlineCoordinator
172-
173- @property
174- def native_value (self ) -> str | int | float | datetime | None :
175- """Return the sensor value."""
176- return self .entity_description .value_fn (self .coordinator .data )
177-
178-
179- class EveOnlineCharacterSensor (EveOnlineCharacterEntity , EveOnlineSensor ):
180- """Eve Online character sensor (per-character device)."""
181171
182172 def __init__ (
183173 self ,
@@ -187,3 +177,8 @@ def __init__(
187177 """Initialize the sensor."""
188178 super ().__init__ (coordinator , description .key )
189179 self .entity_description = description
180+
181+ @property
182+ def native_value (self ) -> str | int | float | datetime | None :
183+ """Return the sensor value."""
184+ return self .entity_description .value_fn (self .coordinator .data )
Original file line number Diff line number Diff line change 99from homeassistant .components .eveonline .const import DOMAIN
1010from homeassistant .exceptions import (
1111 ConfigEntryAuthFailed ,
12- ConfigEntryNotReady ,
1312 OAuth2TokenRequestReauthError ,
1413 OAuth2TokenRequestTransientError ,
1514)
15+ from homeassistant .helpers .update_coordinator import UpdateFailed
1616
1717
1818def _make_auth (
@@ -43,16 +43,16 @@ async def test_get_access_token_reauth_error() -> None:
4343
4444
4545async def test_get_access_token_transient_error () -> None :
46- """Test that OAuth2TokenRequestTransientError raises ConfigEntryNotReady ."""
46+ """Test that OAuth2TokenRequestTransientError raises UpdateFailed ."""
4747 auth = _make_auth (
4848 OAuth2TokenRequestTransientError (domain = DOMAIN , request_info = Mock ())
4949 )
50- with pytest .raises (ConfigEntryNotReady ):
50+ with pytest .raises (UpdateFailed ):
5151 await auth .async_get_access_token ()
5252
5353
5454async def test_get_access_token_client_error () -> None :
55- """Test that aiohttp.ClientError raises ConfigEntryNotReady ."""
55+ """Test that aiohttp.ClientError raises UpdateFailed ."""
5656 auth = _make_auth (aiohttp .ClientError ("network" ))
57- with pytest .raises (ConfigEntryNotReady ):
57+ with pytest .raises (UpdateFailed ):
5858 await auth .async_get_access_token ()
You can’t perform that action at this time.
0 commit comments