Rename otbr integration (#86284)

Rename otbr integration
This commit is contained in:
Erik Montnemery 2023-01-20 14:32:41 +01:00 committed by GitHub
parent d94f007dbf
commit ae39b95bb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 24 deletions

View file

@ -14,7 +14,7 @@ from .const import DOMAIN
class OTBRConfigFlow(ConfigFlow, domain=DOMAIN): class OTBRConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Home Assistant SkyConnect.""" """Handle a config flow for Open Thread Border Router."""
VERSION = 1 VERSION = 1
@ -37,7 +37,7 @@ class OTBRConfigFlow(ConfigFlow, domain=DOMAIN):
else: else:
await self.async_set_unique_id(DOMAIN) await self.async_set_unique_id(DOMAIN)
return self.async_create_entry( return self.async_create_entry(
title="Thread", title="Open Thread Border Router",
data=user_input, data=user_input,
) )
@ -55,6 +55,6 @@ class OTBRConfigFlow(ConfigFlow, domain=DOMAIN):
url = f"http://{config['host']}:{config['port']}" url = f"http://{config['host']}:{config['port']}"
await self.async_set_unique_id(DOMAIN) await self.async_set_unique_id(DOMAIN)
return self.async_create_entry( return self.async_create_entry(
title="Thread", title="Open Thread Border Router",
data={"url": url}, data={"url": url},
) )

View file

@ -1,6 +1,6 @@
{ {
"domain": "otbr", "domain": "otbr",
"name": "Thread", "name": "Open Thread Border Router",
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/otbr", "documentation": "https://www.home-assistant.io/integrations/otbr",
"requirements": ["python-otbr-api==1.0.1"], "requirements": ["python-otbr-api==1.0.1"],

View file

@ -3966,7 +3966,7 @@
"iot_class": "local_polling" "iot_class": "local_polling"
}, },
"otbr": { "otbr": {
"name": "Thread", "name": "Open Thread Border Router",
"integration_type": "service", "integration_type": "service",
"config_flow": true, "config_flow": true,
"iot_class": "local_polling" "iot_class": "local_polling"

View file

@ -1,2 +1,2 @@
"""Tests for the Thread integration.""" """Tests for the Open Thread Border Router integration."""
BASE_URL = "http://core-silabs-multiprotocol:8081" BASE_URL = "http://core-silabs-multiprotocol:8081"

View file

@ -1,4 +1,4 @@
"""Test fixtures for the Home Assistant SkyConnect integration.""" """Test fixtures for the Open Thread Border Router integration."""
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest
@ -10,14 +10,14 @@ from tests.common import MockConfigEntry
CONFIG_ENTRY_DATA = {"url": "http://core-silabs-multiprotocol:8081"} CONFIG_ENTRY_DATA = {"url": "http://core-silabs-multiprotocol:8081"}
@pytest.fixture(name="thread_config_entry") @pytest.fixture(name="otbr_config_entry")
async def thread_config_entry_fixture(hass): async def otbr_config_entry_fixture(hass):
"""Mock Thread config entry.""" """Mock Open Thread Border Router config entry."""
config_entry = MockConfigEntry( config_entry = MockConfigEntry(
data=CONFIG_ENTRY_DATA, data=CONFIG_ENTRY_DATA,
domain=otbr.DOMAIN, domain=otbr.DOMAIN,
options={}, options={},
title="Thread", title="Open Thread Border Router",
) )
config_entry.add_to_hass(hass) config_entry.add_to_hass(hass)
with patch("python_otbr_api.OTBR.get_active_dataset_tlvs"): with patch("python_otbr_api.OTBR.get_active_dataset_tlvs"):

View file

@ -44,7 +44,7 @@ async def test_user_flow(
}, },
) )
assert result["type"] == FlowResultType.CREATE_ENTRY assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["title"] == "Thread" assert result["title"] == "Open Thread Border Router"
assert result["data"] == expected_data assert result["data"] == expected_data
assert result["options"] == {} assert result["options"] == {}
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -52,7 +52,7 @@ async def test_user_flow(
config_entry = hass.config_entries.async_entries(otbr.DOMAIN)[0] config_entry = hass.config_entries.async_entries(otbr.DOMAIN)[0]
assert config_entry.data == expected_data assert config_entry.data == expected_data
assert config_entry.options == {} assert config_entry.options == {}
assert config_entry.title == "Thread" assert config_entry.title == "Open Thread Border Router"
assert config_entry.unique_id == otbr.DOMAIN assert config_entry.unique_id == otbr.DOMAIN
@ -94,7 +94,7 @@ async def test_hassio_discovery_flow(hass: HomeAssistant) -> None:
} }
assert result["type"] == FlowResultType.CREATE_ENTRY assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["title"] == "Thread" assert result["title"] == "Open Thread Border Router"
assert result["data"] == expected_data assert result["data"] == expected_data
assert result["options"] == {} assert result["options"] == {}
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -102,7 +102,7 @@ async def test_hassio_discovery_flow(hass: HomeAssistant) -> None:
config_entry = hass.config_entries.async_entries(otbr.DOMAIN)[0] config_entry = hass.config_entries.async_entries(otbr.DOMAIN)[0]
assert config_entry.data == expected_data assert config_entry.data == expected_data
assert config_entry.options == {} assert config_entry.options == {}
assert config_entry.title == "Thread" assert config_entry.title == "Open Thread Border Router"
assert config_entry.unique_id == otbr.DOMAIN assert config_entry.unique_id == otbr.DOMAIN
@ -116,7 +116,7 @@ async def test_config_flow_single_entry(hass: HomeAssistant, source: str) -> Non
data={}, data={},
domain=otbr.DOMAIN, domain=otbr.DOMAIN,
options={}, options={},
title="Thread", title="Open Thread Border Router",
) )
config_entry.add_to_hass(hass) config_entry.add_to_hass(hass)

View file

@ -14,7 +14,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker
async def test_remove_entry( async def test_remove_entry(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, thread_config_entry hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, otbr_config_entry
): ):
"""Test async_get_thread_state.""" """Test async_get_thread_state."""
@ -30,7 +30,7 @@ async def test_remove_entry(
async def test_get_active_dataset_tlvs( async def test_get_active_dataset_tlvs(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, thread_config_entry hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, otbr_config_entry
): ):
"""Test async_get_active_dataset_tlvs.""" """Test async_get_active_dataset_tlvs."""
@ -48,7 +48,7 @@ async def test_get_active_dataset_tlvs(
async def test_get_active_dataset_tlvs_empty( async def test_get_active_dataset_tlvs_empty(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, thread_config_entry hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, otbr_config_entry
): ):
"""Test async_get_active_dataset_tlvs.""" """Test async_get_active_dataset_tlvs."""
@ -64,7 +64,7 @@ async def test_get_active_dataset_tlvs_addon_not_installed(hass: HomeAssistant):
async def test_get_active_dataset_tlvs_404( async def test_get_active_dataset_tlvs_404(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, thread_config_entry hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, otbr_config_entry
): ):
"""Test async_get_active_dataset_tlvs with error.""" """Test async_get_active_dataset_tlvs with error."""
@ -74,7 +74,7 @@ async def test_get_active_dataset_tlvs_404(
async def test_get_active_dataset_tlvs_201( async def test_get_active_dataset_tlvs_201(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, thread_config_entry hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, otbr_config_entry
): ):
"""Test async_get_active_dataset_tlvs with error.""" """Test async_get_active_dataset_tlvs with error."""
@ -84,7 +84,7 @@ async def test_get_active_dataset_tlvs_201(
async def test_get_active_dataset_tlvs_invalid( async def test_get_active_dataset_tlvs_invalid(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, thread_config_entry hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, otbr_config_entry
): ):
"""Test async_get_active_dataset_tlvs with error.""" """Test async_get_active_dataset_tlvs with error."""

View file

@ -21,7 +21,7 @@ async def websocket_client(hass, hass_ws_client):
async def test_get_info( async def test_get_info(
hass: HomeAssistant, hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker, aioclient_mock: AiohttpClientMocker,
thread_config_entry, otbr_config_entry,
websocket_client, websocket_client,
): ):
"""Test async_get_info.""" """Test async_get_info."""
@ -73,7 +73,7 @@ async def test_get_info_no_entry(
async def test_get_info_fetch_fails( async def test_get_info_fetch_fails(
hass: HomeAssistant, hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker, aioclient_mock: AiohttpClientMocker,
thread_config_entry, otbr_config_entry,
websocket_client, websocket_client,
): ):
"""Test async_get_info.""" """Test async_get_info."""