Improve tests for AccuWeather integration (#38621)
* Add more tests * Add tests for sensor platform * Add more tests * More tests * Simplify parsing of attributes * Change Quality scale to platinum * Patch the library in the manual update entity test * Add unsupported condition icon test * Do not patch _async_get_data * Apply suggestions from code review * Update config_flow.py * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review * Update tests/components/accuweather/test_weather.py * Apply suggestions from code review * Add return_value Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
1 parent
ca3842b150
commit
a7e19c8896
9 files changed
+1844
-11
No files matched your search
@@ -34,7 +34,7 @@ class AccuWeatherFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
if user_input is not None:
|
||||
websession = async_get_clientsession(self.hass)
|
||||
try:
|
||||
with timeout(10):
|
||||
async with timeout(10):
|
||||
accuweather = AccuWeather(
|
||||
user_input[CONF_API_KEY],
|
||||
websession,
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/accuweather/",
|
||||
"requirements": ["accuweather==0.0.9"],
|
||||
"codeowners": ["@bieniu"],
|
||||
"config_flow": true
|
||||
"config_flow": true,
|
||||
"quality_scale": "platinum"
|
||||
}
|
||||
@@ -154,11 +154,7 @@ class AccuWeatherSensor(Entity):
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
if self.forecast_day is not None:
|
||||
if self.kind == "WindGustDay":
|
||||
self._attrs["direction"] = self.coordinator.data[ATTR_FORECAST][
|
||||
self.forecast_day
|
||||
][self.kind]["Direction"]["English"]
|
||||
elif self.kind == "WindGustNight":
|
||||
if self.kind in ["WindGustDay", "WindGustNight"]:
|
||||
self._attrs["direction"] = self.coordinator.data[ATTR_FORECAST][
|
||||
self.forecast_day
|
||||
][self.kind]["Direction"]["English"]
|
||||
|
||||
Reference in new issue
Block a user