Add tests/components/conftest.py to core files (#128425)

This commit is contained in:
epenet
2024-10-15 10:34:54 +02:00
committed by GitHub
parent c3e7fcc153
commit 3ba3fbf4a5
7 changed files with 34 additions and 0 deletions

View File

@ -127,6 +127,7 @@ tests: &tests
- tests/*.py
- tests/auth/**
- tests/backports/**
- tests/components/conftest.py
- tests/components/diagnostics/**
- tests/components/history/**
- tests/components/logbook/**

View File

@ -500,6 +500,10 @@ async def test_initialize_flow_unauth(
assert resp.status == HTTPStatus.UNAUTHORIZED
@pytest.mark.parametrize(
"ignore_translations",
["component.test.config.abort.bla"],
)
async def test_abort(hass: HomeAssistant, client: TestClient) -> None:
"""Test a flow that aborts."""
mock_platform(hass, "test.config_flow", None)
@ -2351,6 +2355,10 @@ async def test_flow_with_multiple_schema_errors_base(
}
@pytest.mark.parametrize(
"ignore_translations",
["component.test.config.abort.reconfigure_successful"],
)
@pytest.mark.usefixtures("enable_custom_integrations", "freezer")
async def test_supports_reconfigure(
hass: HomeAssistant,

View File

@ -110,6 +110,10 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
assert result2["errors"] == {"base": "cannot_connect"}
@pytest.mark.parametrize( # Remove when translations fixed
"ignore_translations",
["component.flume.config.abort.reauth_successful"],
)
@pytest.mark.usefixtures("access_token")
async def test_reauth(hass: HomeAssistant, requests_mock: Mocker) -> None:
"""Test we can reauth."""

View File

@ -45,6 +45,10 @@ def current_request_with_host(current_request: MagicMock) -> None:
)
@pytest.mark.parametrize( # Remove when translations fixed
"ignore_translations",
["component.iotty.config.abort.missing_credentials"],
)
async def test_config_flow_no_credentials(hass: HomeAssistant) -> None:
"""Test config flow base case with no credentials registered."""
result = await hass.config_entries.flow.async_init(

View File

@ -3,6 +3,7 @@
from unittest.mock import patch
import aiohttp
import pytest
from homeassistant import config_entries
from homeassistant.components.ovo_energy.const import CONF_ACCOUNT, DOMAIN
@ -172,6 +173,10 @@ async def test_reauth_connection_error(hass: HomeAssistant) -> None:
assert result2["errors"] == {"base": "connection_error"}
@pytest.mark.parametrize( # Remove when translations fixed
"ignore_translations",
["component.ovo_energy.config.abort.reauth_successful"],
)
async def test_reauth_flow(hass: HomeAssistant) -> None:
"""Test reauth works."""
mock_config = MockConfigEntry(

View File

@ -89,6 +89,10 @@ async def test_form_errors(
assert result3["type"] is FlowResultType.CREATE_ENTRY
@pytest.mark.parametrize( # Remove when translations fixed
"ignore_translations",
["component.teslemetry.config.abort.reauth_successful"],
)
async def test_reauth(hass: HomeAssistant, mock_metadata: AsyncMock) -> None:
"""Test reauth flow."""
@ -120,6 +124,10 @@ async def test_reauth(hass: HomeAssistant, mock_metadata: AsyncMock) -> None:
assert mock_entry.data == CONFIG
@pytest.mark.parametrize( # Remove when translations fixed
"ignore_translations",
["component.teslemetry.config.abort.reauth_successful"],
)
@pytest.mark.parametrize(
("side_effect", "error"),
[

View File

@ -249,6 +249,10 @@ async def test_agreement_already_set_up(
assert result3["reason"] == "already_configured"
@pytest.mark.parametrize( # Remove when translations fixed
"ignore_translations",
["component.toon.config.abort.connection_error"],
)
@pytest.mark.usefixtures("current_request_with_host")
async def test_toon_abort(
hass: HomeAssistant,