Repository: home-assistant/core
File: tests/components/lovelace/test_dashboard.py (Python)

Code before:
            return_value={"hello": "yo4"},
        ),
        patch(
            "homeassistant.components.lovelace.dashboard.os.path.getmtime",
            return_value=0,
        ),
    ):
        await client.send_json({"id": 10, "type": "lovelace/config", "force": False})
        response = await client.receive_json()

    assert response["success"]
    assert response["result"] == {"hello": "yo3"}

    assert len(events) == 2


async def test_lovelace_from_yaml_creates_repair_issue(
    hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
    """Test YAML mode creates a repair issue."""
    assert await async_setup_component(hass, "lovelace", {"lovelace": {"mode": "YAML"}})

    # Panel should still be registered for backwards compatibility
    assert hass.data[frontend.DATA_PANELS]["lovelace"].config == {"mode": "yaml"}

    # Repair issue should be created with 6-month deadline
    issue_registry = ir.async_get(hass)
    issue = issue_registry.async_get_issue("lovelace", "yaml_mode_deprecated")
    assert issue is not None
    assert issue.severity == ir.IssueSeverity.WARNING
    assert issue.is_fixable is False
    assert issue.breaks_in_ha_version == "2026.8.0"


@pytest.mark.parametrize("url_path", ["test-panel", "test-panel-no-sidebar"])
async def test_dashboard_from_yaml(
    hass: HomeAssistant, hass_ws_client: WebSocketGenerator, url_path
) -> None:
    """Test we load lovelace dashboard config from yaml."""
    assert await async_setup_component(
        hass,
        "lovelace",
        {
            "lovelace": {
                "dashboards": {
                    "test-panel": {
                        "mode": "yaml",
                        "filename": "bla.yaml",
                        "title": "Test Panel",
                        "icon": "mdi:test-icon",
                        "show_in_sidebar": False,

Review comment (suggestion):
```suggestion
    # Repair issue should be created
```

Code after:
            return_value={"hello": "yo4"},
        ),
        patch(
            "homeassistant.components.lovelace.dashboard.os.path.getmtime",
            return_value=0,
        ),
    ):
        await client.send_json({"id": 10, "type": "lovelace/config", "force": False})
        response = await client.receive_json()

    assert response["success"]
    assert response["result"] == {"hello": "yo3"}

    assert len(events) == 2


async def test_lovelace_from_yaml_creates_repair_issue(
    hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
    """Test YAML mode creates a repair issue."""
    assert await async_setup_component(hass, "lovelace", {"lovelace": {"mode": "YAML"}})

    # Panel should still be registered for backwards compatibility
    assert hass.data[frontend.DATA_PANELS]["lovelace"].config == {"mode": "yaml"}

    # Repair issue should be created
    issue_registry = ir.async_get(hass)
    issue = issue_registry.async_get_issue("lovelace", "yaml_mode_deprecated")
    assert issue is not None
    assert issue.severity == ir.IssueSeverity.WARNING
    assert issue.is_fixable is False
    assert issue.breaks_in_ha_version == "2026.8.0"


@pytest.mark.parametrize("url_path", ["test-panel", "test-panel-no-sidebar"])
async def test_dashboard_from_yaml(
    hass: HomeAssistant, hass_ws_client: WebSocketGenerator, url_path
) -> None:
    """Test we load lovelace dashboard config from yaml."""
    assert await async_setup_component(
        hass,
        "lovelace",
        {
            "lovelace": {
                "dashboards": {
                    "test-panel": {
                        "mode": "yaml",
                        "filename": "bla.yaml",
                        "title": "Test Panel",
                        "icon": "mdi:test-icon",
                        "show_in_sidebar": False,