From 451c085587ac6f0b9d239861a58de66315f0e1aa Mon Sep 17 00:00:00 2001 From: Nathan Tilley <nathan@tilley.xyz> Date: Sat, 23 Sep 2023 15:06:49 -0700 Subject: [PATCH] Bump faadelays to 2023.8.0 (#100700) * Update component to use new API version * Revert new features, implement #95546, bump library * Revert #95546 changes, remove NOTAM --- .../components/faa_delays/binary_sensor.py | 5 ++-- .../components/faa_delays/config_flow.py | 9 ++----- .../components/faa_delays/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- .../components/faa_delays/test_config_flow.py | 25 ++----------------- 6 files changed, 9 insertions(+), 36 deletions(-) diff --git a/homeassistant/components/faa_delays/binary_sensor.py b/homeassistant/components/faa_delays/binary_sensor.py index bc09a604cd6..54b22812c84 100644 --- a/homeassistant/components/faa_delays/binary_sensor.py +++ b/homeassistant/components/faa_delays/binary_sensor.py @@ -42,7 +42,7 @@ class FAABinarySensor(CoordinatorEntity, BinarySensorEntity): self.coordinator = coordinator self._entry_id = entry_id self._attrs: dict[str, Any] = {} - _id = coordinator.data.iata + _id = coordinator.data.code self._attr_name = f"{_id} {description.name}" self._attr_unique_id = f"{_id}_{description.key}" @@ -83,7 +83,6 @@ class FAABinarySensor(CoordinatorEntity, BinarySensorEntity): self._attrs["trend"] = self.coordinator.data.arrive_delay.trend self._attrs["reason"] = self.coordinator.data.arrive_delay.reason elif sensor_type == "CLOSURE": - self._attrs["begin"] = self.coordinator.data.closure.begin + self._attrs["begin"] = self.coordinator.data.closure.start self._attrs["end"] = self.coordinator.data.closure.end - self._attrs["reason"] = self.coordinator.data.closure.reason return self._attrs diff --git a/homeassistant/components/faa_delays/config_flow.py b/homeassistant/components/faa_delays/config_flow.py index 023fe4d6a5b..b2f7f69dd49 100644 --- a/homeassistant/components/faa_delays/config_flow.py +++ b/homeassistant/components/faa_delays/config_flow.py @@ -35,10 +35,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): try: await data.update() - except faadelays.InvalidAirport: - _LOGGER.error("Airport code %s is invalid", user_input[CONF_ID]) - errors[CONF_ID] = "invalid_airport" - except ClientConnectionError: _LOGGER.error("Error connecting to FAA API") errors["base"] = "cannot_connect" @@ -49,11 +45,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): if not errors: _LOGGER.debug( - "Creating entry with id: %s, name: %s", + "Creating entry with id: %s", user_input[CONF_ID], - data.name, ) - return self.async_create_entry(title=data.name, data=user_input) + return self.async_create_entry(title=data.code, data=user_input) return self.async_show_form( step_id="user", data_schema=DATA_SCHEMA, errors=errors diff --git a/homeassistant/components/faa_delays/manifest.json b/homeassistant/components/faa_delays/manifest.json index 8fb07d1e187..07c2cfea771 100644 --- a/homeassistant/components/faa_delays/manifest.json +++ b/homeassistant/components/faa_delays/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/faa_delays", "iot_class": "cloud_polling", "loggers": ["faadelays"], - "requirements": ["faadelays==0.0.7"] + "requirements": ["faadelays==2023.9.1"] } diff --git a/requirements_all.txt b/requirements_all.txt index e038c435aca..13ad421df96 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -777,7 +777,7 @@ eufylife-ble-client==0.1.7 evohome-async==0.3.15 # homeassistant.components.faa_delays -faadelays==0.0.7 +faadelays==2023.9.1 # homeassistant.components.dlib_face_detect # homeassistant.components.dlib_face_identify diff --git a/requirements_test_all.txt b/requirements_test_all.txt index bf22ba34a65..6f1e3adc781 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -621,7 +621,7 @@ esphome-dashboard-api==1.2.3 eufylife-ble-client==0.1.7 # homeassistant.components.faa_delays -faadelays==0.0.7 +faadelays==2023.9.1 # homeassistant.components.feedreader feedparser==6.0.10 diff --git a/tests/components/faa_delays/test_config_flow.py b/tests/components/faa_delays/test_config_flow.py index 9eb166d5f69..5fb1b9cfcd2 100644 --- a/tests/components/faa_delays/test_config_flow.py +++ b/tests/components/faa_delays/test_config_flow.py @@ -15,7 +15,7 @@ from tests.common import MockConfigEntry async def mock_valid_airport(self, *args, **kwargs): """Return a valid airport.""" - self.name = "Test airport" + self.code = "test" async def test_form(hass: HomeAssistant) -> None: @@ -40,7 +40,7 @@ async def test_form(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert result2["type"] == "create_entry" - assert result2["title"] == "Test airport" + assert result2["title"] == "test" assert result2["data"] == { "id": "test", } @@ -61,27 +61,6 @@ async def test_duplicate_error(hass: HomeAssistant) -> None: assert result["reason"] == "already_configured" -async def test_form_invalid_airport(hass: HomeAssistant) -> None: - """Test we handle invalid airport.""" - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": config_entries.SOURCE_USER} - ) - - with patch( - "faadelays.Airport.update", - side_effect=faadelays.InvalidAirport, - ): - result2 = await hass.config_entries.flow.async_configure( - result["flow_id"], - { - "id": "test", - }, - ) - - assert result2["type"] == "form" - assert result2["errors"] == {CONF_ID: "invalid_airport"} - - async def test_form_cannot_connect(hass: HomeAssistant) -> None: """Test we handle a connection error.""" result = await hass.config_entries.flow.async_init( -- GitLab