mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add tests/components/conftest.py to core files (#128425)
This commit is contained in:
parent
c3e7fcc153
commit
3ba3fbf4a5
@ -127,6 +127,7 @@ tests: &tests
|
|||||||
- tests/*.py
|
- tests/*.py
|
||||||
- tests/auth/**
|
- tests/auth/**
|
||||||
- tests/backports/**
|
- tests/backports/**
|
||||||
|
- tests/components/conftest.py
|
||||||
- tests/components/diagnostics/**
|
- tests/components/diagnostics/**
|
||||||
- tests/components/history/**
|
- tests/components/history/**
|
||||||
- tests/components/logbook/**
|
- tests/components/logbook/**
|
||||||
|
@ -500,6 +500,10 @@ async def test_initialize_flow_unauth(
|
|||||||
assert resp.status == HTTPStatus.UNAUTHORIZED
|
assert resp.status == HTTPStatus.UNAUTHORIZED
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"ignore_translations",
|
||||||
|
["component.test.config.abort.bla"],
|
||||||
|
)
|
||||||
async def test_abort(hass: HomeAssistant, client: TestClient) -> None:
|
async def test_abort(hass: HomeAssistant, client: TestClient) -> None:
|
||||||
"""Test a flow that aborts."""
|
"""Test a flow that aborts."""
|
||||||
mock_platform(hass, "test.config_flow", None)
|
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")
|
@pytest.mark.usefixtures("enable_custom_integrations", "freezer")
|
||||||
async def test_supports_reconfigure(
|
async def test_supports_reconfigure(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
@ -110,6 +110,10 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
|||||||
assert result2["errors"] == {"base": "cannot_connect"}
|
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")
|
@pytest.mark.usefixtures("access_token")
|
||||||
async def test_reauth(hass: HomeAssistant, requests_mock: Mocker) -> None:
|
async def test_reauth(hass: HomeAssistant, requests_mock: Mocker) -> None:
|
||||||
"""Test we can reauth."""
|
"""Test we can reauth."""
|
||||||
|
@ -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:
|
async def test_config_flow_no_credentials(hass: HomeAssistant) -> None:
|
||||||
"""Test config flow base case with no credentials registered."""
|
"""Test config flow base case with no credentials registered."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
import pytest
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components.ovo_energy.const import CONF_ACCOUNT, DOMAIN
|
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"}
|
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:
|
async def test_reauth_flow(hass: HomeAssistant) -> None:
|
||||||
"""Test reauth works."""
|
"""Test reauth works."""
|
||||||
mock_config = MockConfigEntry(
|
mock_config = MockConfigEntry(
|
||||||
|
@ -89,6 +89,10 @@ async def test_form_errors(
|
|||||||
assert result3["type"] is FlowResultType.CREATE_ENTRY
|
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:
|
async def test_reauth(hass: HomeAssistant, mock_metadata: AsyncMock) -> None:
|
||||||
"""Test reauth flow."""
|
"""Test reauth flow."""
|
||||||
|
|
||||||
@ -120,6 +124,10 @@ async def test_reauth(hass: HomeAssistant, mock_metadata: AsyncMock) -> None:
|
|||||||
assert mock_entry.data == CONFIG
|
assert mock_entry.data == CONFIG
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize( # Remove when translations fixed
|
||||||
|
"ignore_translations",
|
||||||
|
["component.teslemetry.config.abort.reauth_successful"],
|
||||||
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("side_effect", "error"),
|
("side_effect", "error"),
|
||||||
[
|
[
|
||||||
|
@ -249,6 +249,10 @@ async def test_agreement_already_set_up(
|
|||||||
assert result3["reason"] == "already_configured"
|
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")
|
@pytest.mark.usefixtures("current_request_with_host")
|
||||||
async def test_toon_abort(
|
async def test_toon_abort(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user