mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 23:07:09 +00:00
Replace assert_lists_same with pytest_unordered in integrations n-s (#94902)
This commit is contained in:
parent
6a29ed8caa
commit
eba04824a4
@ -1,6 +1,7 @@
|
|||||||
"""The tests for Nest device triggers."""
|
"""The tests for Nest device triggers."""
|
||||||
from google_nest_sdm.event import EventMessage
|
from google_nest_sdm.event import EventMessage
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -17,7 +18,6 @@ from homeassistant.util.dt import utcnow
|
|||||||
from .common import DEVICE_ID, CreateDevice, FakeSubscriber, PlatformSetup
|
from .common import DEVICE_ID, CreateDevice, FakeSubscriber, PlatformSetup
|
||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
)
|
)
|
||||||
@ -124,7 +124,7 @@ async def test_get_triggers(
|
|||||||
triggers = await async_get_device_automations(
|
triggers = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
async def test_multiple_devices(
|
async def test_multiple_devices(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""The tests for Netatmo device triggers."""
|
"""The tests for Netatmo device triggers."""
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -18,7 +19,6 @@ from homeassistant.setup import async_setup_component
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_capture_events,
|
async_capture_events,
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
@ -92,7 +92,7 @@ async def test_get_triggers(
|
|||||||
)
|
)
|
||||||
if trigger["domain"] == NETATMO_DOMAIN
|
if trigger["domain"] == NETATMO_DOMAIN
|
||||||
]
|
]
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""The tests for Number device actions."""
|
"""The tests for Number device actions."""
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
import voluptuous_serialize
|
import voluptuous_serialize
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
@ -17,7 +18,6 @@ from homeassistant.setup import async_setup_component
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
)
|
)
|
||||||
@ -56,7 +56,7 @@ async def test_get_actions(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -104,7 +104,7 @@ async def test_get_actions_hidden_auxiliary(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_action_no_state(
|
async def test_get_action_no_state(
|
||||||
@ -134,7 +134,7 @@ async def test_get_action_no_state(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
async def test_action(hass: HomeAssistant) -> None:
|
async def test_action(hass: HomeAssistant) -> None:
|
||||||
|
@ -3,6 +3,7 @@ from unittest.mock import MagicMock
|
|||||||
|
|
||||||
from pynut2.nut2 import PyNUTError
|
from pynut2.nut2 import PyNUTError
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
from homeassistant.components import automation, device_automation
|
from homeassistant.components import automation, device_automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -14,7 +15,7 @@ from homeassistant.setup import async_setup_component
|
|||||||
|
|
||||||
from .util import async_init_integration
|
from .util import async_init_integration
|
||||||
|
|
||||||
from tests.common import assert_lists_same, async_get_device_automations
|
from tests.common import async_get_device_automations
|
||||||
|
|
||||||
|
|
||||||
async def test_get_all_actions_for_specified_user(
|
async def test_get_all_actions_for_specified_user(
|
||||||
@ -47,7 +48,7 @@ async def test_get_all_actions_for_specified_user(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
async def test_no_actions_for_anonymous_user(
|
async def test_no_actions_for_anonymous_user(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""The tests for Philips TV device triggers."""
|
"""The tests for Philips TV device triggers."""
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -8,7 +9,6 @@ from homeassistant.core import HomeAssistant
|
|||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
)
|
)
|
||||||
@ -40,7 +40,7 @@ async def test_get_triggers(hass: HomeAssistant, mock_device) -> None:
|
|||||||
hass, DeviceAutomationType.TRIGGER, mock_device.id
|
hass, DeviceAutomationType.TRIGGER, mock_device.id
|
||||||
)
|
)
|
||||||
triggers = [trigger for trigger in triggers if trigger["domain"] == DOMAIN]
|
triggers = [trigger for trigger in triggers if trigger["domain"] == DOMAIN]
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
async def test_if_fires_on_turn_on_request(
|
async def test_if_fires_on_turn_on_request(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""The test for remote device automation."""
|
"""The test for remote device automation."""
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -12,7 +13,6 @@ from homeassistant.setup import async_setup_component
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
)
|
)
|
||||||
@ -57,7 +57,7 @@ async def test_get_actions(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -105,7 +105,7 @@ async def test_get_actions_hidden_auxiliary(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
async def test_action(
|
async def test_action(
|
||||||
|
@ -3,6 +3,7 @@ from datetime import timedelta
|
|||||||
|
|
||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -16,7 +17,6 @@ import homeassistant.util.dt as dt_util
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automation_capabilities,
|
async_get_device_automation_capabilities,
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
@ -63,7 +63,7 @@ async def test_get_conditions(
|
|||||||
conditions = await async_get_device_automations(
|
conditions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -111,7 +111,7 @@ async def test_get_conditions_hidden_auxiliary(
|
|||||||
conditions = await async_get_device_automations(
|
conditions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_condition_capabilities(
|
async def test_get_condition_capabilities(
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -15,7 +16,6 @@ import homeassistant.util.dt as dt_util
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_fire_time_changed,
|
async_fire_time_changed,
|
||||||
async_get_device_automation_capabilities,
|
async_get_device_automation_capabilities,
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
@ -63,7 +63,7 @@ async def test_get_triggers(
|
|||||||
triggers = await async_get_device_automations(
|
triggers = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -111,7 +111,7 @@ async def test_get_triggers_hidden_auxiliary(
|
|||||||
triggers = await async_get_device_automations(
|
triggers = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_trigger_capabilities(
|
async def test_get_trigger_capabilities(
|
||||||
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||||||
from typing import Any, NamedTuple
|
from typing import Any, NamedTuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
import RFXtrx
|
import RFXtrx
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
@ -17,7 +18,6 @@ from .conftest import create_rfx_test_cfg
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ async def test_get_actions(
|
|||||||
for action_type in expected
|
for action_type in expected
|
||||||
]
|
]
|
||||||
|
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||||||
from typing import Any, NamedTuple
|
from typing import Any, NamedTuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -16,7 +17,6 @@ from .conftest import create_rfx_test_cfg
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
)
|
)
|
||||||
@ -113,7 +113,7 @@ async def test_get_triggers(
|
|||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
triggers = [value for value in triggers if value["domain"] == "rfxtrx"]
|
triggers = [value for value in triggers if value["domain"] == "rfxtrx"]
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""The tests for Select device actions."""
|
"""The tests for Select device actions."""
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
import voluptuous_serialize
|
import voluptuous_serialize
|
||||||
|
|
||||||
from homeassistant.components import automation
|
from homeassistant.components import automation
|
||||||
@ -17,7 +18,6 @@ from homeassistant.setup import async_setup_component
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
)
|
)
|
||||||
@ -57,7 +57,7 @@ async def test_get_actions(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -111,7 +111,7 @@ async def test_get_actions_hidden_auxiliary(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("action_type", ("select_first", "select_last"))
|
@pytest.mark.parametrize("action_type", ("select_first", "select_last"))
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
import voluptuous_serialize
|
import voluptuous_serialize
|
||||||
|
|
||||||
from homeassistant.components import automation
|
from homeassistant.components import automation
|
||||||
@ -21,7 +22,6 @@ from homeassistant.setup import async_setup_component
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
)
|
)
|
||||||
@ -61,7 +61,7 @@ async def test_get_conditions(
|
|||||||
conditions = await async_get_device_automations(
|
conditions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -109,7 +109,7 @@ async def test_get_conditions_hidden_auxiliary(
|
|||||||
conditions = await async_get_device_automations(
|
conditions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
async def test_if_selected_option(
|
async def test_if_selected_option(
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
import voluptuous_serialize
|
import voluptuous_serialize
|
||||||
|
|
||||||
from homeassistant.components import automation
|
from homeassistant.components import automation
|
||||||
@ -21,7 +22,6 @@ from homeassistant.setup import async_setup_component
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
)
|
)
|
||||||
@ -61,7 +61,7 @@ async def test_get_triggers(
|
|||||||
triggers = await async_get_device_automations(
|
triggers = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -109,7 +109,7 @@ async def test_get_triggers_hidden_auxiliary(
|
|||||||
triggers = await async_get_device_automations(
|
triggers = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
async def test_if_fires_on_state_change(hass: HomeAssistant, calls) -> None:
|
async def test_if_fires_on_state_change(hass: HomeAssistant, calls) -> None:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""The test for sensor device automation."""
|
"""The test for sensor device automation."""
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -21,7 +22,6 @@ from homeassistant.util.json import load_json
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automation_capabilities,
|
async_get_device_automation_capabilities,
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
@ -124,7 +124,7 @@ async def test_get_conditions(
|
|||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert len(conditions) == 27
|
assert len(conditions) == 27
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -173,7 +173,7 @@ async def test_get_conditions_hidden_auxiliary(
|
|||||||
conditions = await async_get_device_automations(
|
conditions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_conditions_no_state(
|
async def test_get_conditions_no_state(
|
||||||
@ -218,7 +218,7 @@ async def test_get_conditions_no_state(
|
|||||||
conditions = await async_get_device_automations(
|
conditions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -268,7 +268,7 @@ async def test_get_conditions_no_unit_or_stateclass(
|
|||||||
conditions = await async_get_device_automations(
|
conditions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -24,7 +25,6 @@ from homeassistant.util.json import load_json
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_fire_time_changed,
|
async_fire_time_changed,
|
||||||
async_get_device_automation_capabilities,
|
async_get_device_automation_capabilities,
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
@ -126,7 +126,7 @@ async def test_get_triggers(
|
|||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert len(triggers) == 27
|
assert len(triggers) == 27
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -175,7 +175,7 @@ async def test_get_triggers_hidden_auxiliary(
|
|||||||
triggers = await async_get_device_automations(
|
triggers = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -225,7 +225,7 @@ async def test_get_triggers_no_unit_or_stateclass(
|
|||||||
triggers = await async_get_device_automations(
|
triggers = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""The tests for Shelly device triggers."""
|
"""The tests for Shelly device triggers."""
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
from homeassistant.components import automation
|
from homeassistant.components import automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -26,7 +27,6 @@ from . import init_integration
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ async def test_get_triggers_block_device(
|
|||||||
hass, DeviceAutomationType.TRIGGER, device.id
|
hass, DeviceAutomationType.TRIGGER, device.id
|
||||||
)
|
)
|
||||||
triggers = [value for value in triggers if value["domain"] == DOMAIN]
|
triggers = [value for value in triggers if value["domain"] == DOMAIN]
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_triggers_rpc_device(hass: HomeAssistant, mock_rpc_device) -> None:
|
async def test_get_triggers_rpc_device(hass: HomeAssistant, mock_rpc_device) -> None:
|
||||||
@ -106,7 +106,7 @@ async def test_get_triggers_rpc_device(hass: HomeAssistant, mock_rpc_device) ->
|
|||||||
hass, DeviceAutomationType.TRIGGER, device.id
|
hass, DeviceAutomationType.TRIGGER, device.id
|
||||||
)
|
)
|
||||||
triggers = [value for value in triggers if value["domain"] == DOMAIN]
|
triggers = [value for value in triggers if value["domain"] == DOMAIN]
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_triggers_button(hass: HomeAssistant, mock_block_device) -> None:
|
async def test_get_triggers_button(hass: HomeAssistant, mock_block_device) -> None:
|
||||||
@ -131,7 +131,7 @@ async def test_get_triggers_button(hass: HomeAssistant, mock_block_device) -> No
|
|||||||
hass, DeviceAutomationType.TRIGGER, device.id
|
hass, DeviceAutomationType.TRIGGER, device.id
|
||||||
)
|
)
|
||||||
triggers = [value for value in triggers if value["domain"] == DOMAIN]
|
triggers = [value for value in triggers if value["domain"] == DOMAIN]
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_triggers_non_initialized_devices(
|
async def test_get_triggers_non_initialized_devices(
|
||||||
@ -149,7 +149,7 @@ async def test_get_triggers_non_initialized_devices(
|
|||||||
hass, DeviceAutomationType.TRIGGER, device.id
|
hass, DeviceAutomationType.TRIGGER, device.id
|
||||||
)
|
)
|
||||||
triggers = [value for value in triggers if value["domain"] == DOMAIN]
|
triggers = [value for value in triggers if value["domain"] == DOMAIN]
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_triggers_for_invalid_device_id(
|
async def test_get_triggers_for_invalid_device_id(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""The test for switch device automation."""
|
"""The test for switch device automation."""
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -12,7 +13,6 @@ from homeassistant.setup import async_setup_component
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
)
|
)
|
||||||
@ -58,7 +58,7 @@ async def test_get_actions(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -106,7 +106,7 @@ async def test_get_actions_hidden_auxiliary(
|
|||||||
actions = await async_get_device_automations(
|
actions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(actions, expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
async def test_action(
|
async def test_action(
|
||||||
|
@ -3,6 +3,7 @@ from datetime import timedelta
|
|||||||
|
|
||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -16,7 +17,6 @@ import homeassistant.util.dt as dt_util
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_get_device_automation_capabilities,
|
async_get_device_automation_capabilities,
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
@ -63,7 +63,7 @@ async def test_get_conditions(
|
|||||||
conditions = await async_get_device_automations(
|
conditions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -111,7 +111,7 @@ async def test_get_conditions_hidden_auxiliary(
|
|||||||
conditions = await async_get_device_automations(
|
conditions = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(conditions, expected_conditions)
|
assert conditions == unordered(expected_conditions)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_condition_capabilities(
|
async def test_get_condition_capabilities(
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from pytest_unordered import unordered
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_automation import DeviceAutomationType
|
from homeassistant.components.device_automation import DeviceAutomationType
|
||||||
@ -15,7 +16,6 @@ import homeassistant.util.dt as dt_util
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
assert_lists_same,
|
|
||||||
async_fire_time_changed,
|
async_fire_time_changed,
|
||||||
async_get_device_automation_capabilities,
|
async_get_device_automation_capabilities,
|
||||||
async_get_device_automations,
|
async_get_device_automations,
|
||||||
@ -63,7 +63,7 @@ async def test_get_triggers(
|
|||||||
triggers = await async_get_device_automations(
|
triggers = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -111,7 +111,7 @@ async def test_get_triggers_hidden_auxiliary(
|
|||||||
triggers = await async_get_device_automations(
|
triggers = await async_get_device_automations(
|
||||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||||
)
|
)
|
||||||
assert_lists_same(triggers, expected_triggers)
|
assert triggers == unordered(expected_triggers)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_trigger_capabilities(
|
async def test_get_trigger_capabilities(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user