Skip to content

Commit

Permalink
Remove the deprecated discovery_info endpoint (home-assistant#64534)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Jan 20, 2022
1 parent 3258f66 commit 04c5e51
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 47 deletions.
29 changes: 0 additions & 29 deletions homeassistant/components/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
URL_API,
URL_API_COMPONENTS,
URL_API_CONFIG,
URL_API_DISCOVERY_INFO,
URL_API_ERROR_LOG,
URL_API_EVENTS,
URL_API_SERVICES,
Expand Down Expand Up @@ -56,7 +55,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
hass.http.register_view(APIStatusView)
hass.http.register_view(APIEventStream)
hass.http.register_view(APIConfigView)
hass.http.register_view(APIDiscoveryView)
hass.http.register_view(APIStatesView)
hass.http.register_view(APIEntityStateView)
hass.http.register_view(APIEventListenersView)
Expand Down Expand Up @@ -167,33 +165,6 @@ def get(self, request):
return self.json(request.app["hass"].config.as_dict())


class APIDiscoveryView(HomeAssistantView):
"""
View to provide Discovery information.
DEPRECATED: To be removed in 2022.1
"""

requires_auth = False
url = URL_API_DISCOVERY_INFO
name = "api:discovery"

async def get(self, request):
"""Get discovery information."""
return self.json(
{
ATTR_UUID: "",
ATTR_BASE_URL: "",
ATTR_EXTERNAL_URL: "",
ATTR_INTERNAL_URL: "",
ATTR_LOCATION_NAME: "",
ATTR_INSTALLATION_TYPE: "",
ATTR_REQUIRES_API_PASSWORD: True,
ATTR_VERSION: "",
}
)


class APIStatesView(HomeAssistantView):
"""View to handle States requests."""

Expand Down
1 change: 0 additions & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ class Platform(StrEnum):
URL_API: Final = "/api/"
URL_API_STREAM: Final = "/api/stream"
URL_API_CONFIG: Final = "/api/config"
URL_API_DISCOVERY_INFO: Final = "/api/discovery_info"
URL_API_STATES: Final = "/api/states"
URL_API_STATES_ENTITY: Final = "/api/states/{}"
URL_API_EVENTS: Final = "/api/events"
Expand Down
17 changes: 0 additions & 17 deletions tests/components/api/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,20 +560,3 @@ def listener(service_call):
"/api/services/test_domain/test_service", json={"hello": 5}
)
assert resp.status == HTTPStatus.BAD_REQUEST


async def test_api_get_discovery_info(hass, mock_api_client):
"""Test the return of discovery info."""
resp = await mock_api_client.get(const.URL_API_DISCOVERY_INFO)
result = await resp.json()

assert result == {
"base_url": "",
"external_url": "",
"installation_type": "",
"internal_url": "",
"location_name": "",
"requires_api_password": True,
"uuid": "",
"version": "",
}

0 comments on commit 04c5e51

Please sign in to comment.