Make jellyfin not single config entry (#147656)

This commit is contained in:
Josef Zweck 2025-06-27 10:31:13 +02:00 committed by Franck Nijhof
parent 0b5d2ab8e4
commit 5c0f2d37f0
No known key found for this signature in database
GPG Key ID: AB33ADACE7101952
4 changed files with 29 additions and 16 deletions

View File

@ -7,6 +7,5 @@
"integration_type": "service", "integration_type": "service",
"iot_class": "local_polling", "iot_class": "local_polling",
"loggers": ["jellyfin_apiclient_python"], "loggers": ["jellyfin_apiclient_python"],
"requirements": ["jellyfin-apiclient-python==1.10.0"], "requirements": ["jellyfin-apiclient-python==1.10.0"]
"single_config_entry": true
} }

View File

@ -3159,8 +3159,7 @@
"name": "Jellyfin", "name": "Jellyfin",
"integration_type": "service", "integration_type": "service",
"config_flow": true, "config_flow": true,
"iot_class": "local_polling", "iot_class": "local_polling"
"single_config_entry": true
}, },
"jewish_calendar": { "jewish_calendar": {
"name": "Jewish Calendar", "name": "Jewish Calendar",

View File

@ -1,5 +1,5 @@
{ {
"Id": "string", "Id": "USER-UUID",
"ViewType": "string", "ViewType": "string",
"SortBy": "string", "SortBy": "string",
"IndexBy": "string", "IndexBy": "string",

View File

@ -23,17 +23,6 @@ from tests.common import MockConfigEntry
pytestmark = pytest.mark.usefixtures("mock_setup_entry") pytestmark = pytest.mark.usefixtures("mock_setup_entry")
async def test_abort_if_existing_entry(hass: HomeAssistant) -> None:
"""Check flow abort when an entry already exist."""
MockConfigEntry(domain=DOMAIN).add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "single_instance_allowed"
async def test_form( async def test_form(
hass: HomeAssistant, hass: HomeAssistant,
mock_jellyfin: MagicMock, mock_jellyfin: MagicMock,
@ -201,6 +190,32 @@ async def test_form_persists_device_id_on_error(
} }
async def test_already_configured(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
mock_jellyfin: MagicMock,
mock_client: MagicMock,
) -> None:
"""Test the case where the user tries to configure an already configured entry."""
mock_config_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] is FlowResultType.FORM
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input=USER_INPUT,
)
await hass.async_block_till_done()
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
async def test_reauth( async def test_reauth(
hass: HomeAssistant, hass: HomeAssistant,
mock_config_entry: MockConfigEntry, mock_config_entry: MockConfigEntry,