Skip to content

Commit

Permalink
Add tests/components/conftest.py to core files (home-assistant#128425)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Oct 15, 2024
1 parent c3e7fcc commit 3ba3fbf
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .core_files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**
Expand Down
8 changes: 8 additions & 0 deletions tests/components/config/test_config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ async def async_step_user(self, user_input=None):
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)
Expand Down Expand Up @@ -2351,6 +2355,10 @@ async def async_step_user(self, user_input=None):
}


@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,
Expand Down
4 changes: 4 additions & 0 deletions tests/components/flume/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
4 changes: 4 additions & 0 deletions tests/components/iotty/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 5 additions & 0 deletions tests/components/ovo_energy/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
8 changes: 8 additions & 0 deletions tests/components/teslemetry/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down Expand Up @@ -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"),
[
Expand Down
4 changes: 4 additions & 0 deletions tests/components/toon/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3ba3fbf

Please sign in to comment.