From 04c5e51cbdff43fb8d2d3f54fc8cdeeb2bf473cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 20 Jan 2022 13:46:48 +0100 Subject: [PATCH] Remove the deprecated discovery_info endpoint (#64534) --- homeassistant/components/api/__init__.py | 29 ------------------------ homeassistant/const.py | 1 - tests/components/api/test_init.py | 17 -------------- 3 files changed, 47 deletions(-) diff --git a/homeassistant/components/api/__init__.py b/homeassistant/components/api/__init__.py index c21919d22f7..28744455aee 100644 --- a/homeassistant/components/api/__init__.py +++ b/homeassistant/components/api/__init__.py @@ -19,7 +19,6 @@ from homeassistant.const import ( URL_API, URL_API_COMPONENTS, URL_API_CONFIG, - URL_API_DISCOVERY_INFO, URL_API_ERROR_LOG, URL_API_EVENTS, URL_API_SERVICES, @@ -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) @@ -167,33 +165,6 @@ class APIConfigView(HomeAssistantView): 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.""" diff --git a/homeassistant/const.py b/homeassistant/const.py index 8dbde276e4c..1c89dae3256 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -699,7 +699,6 @@ URL_ROOT: Final = "/" 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" diff --git a/tests/components/api/test_init.py b/tests/components/api/test_init.py index b9a7b80fcf6..d56389c7230 100644 --- a/tests/components/api/test_init.py +++ b/tests/components/api/test_init.py @@ -560,20 +560,3 @@ async def test_api_call_service_bad_data(hass, mock_api_client): "/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": "", - }