mirror of
https://github.com/home-assistant/core.git
synced 2025-11-17 23:10:28 +00:00
Migrate homekit_controller tests to use freezegun (#105646)
This commit is contained in:
committed by
GitHub
parent
08ca3678da
commit
d322cb5fdf
@@ -89,7 +89,7 @@ def create_fanv2_service_without_rotation_speed(accessory):
|
||||
swing_mode.value = 0
|
||||
|
||||
|
||||
async def test_fan_read_state(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_fan_read_state(hass: HomeAssistant) -> None:
|
||||
"""Test that we can read the state of a HomeKit fan accessory."""
|
||||
helper = await setup_test_component(hass, create_fan_service)
|
||||
|
||||
@@ -104,7 +104,7 @@ async def test_fan_read_state(hass: HomeAssistant, utcnow) -> None:
|
||||
assert state.state == "on"
|
||||
|
||||
|
||||
async def test_turn_on(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_turn_on(hass: HomeAssistant) -> None:
|
||||
"""Test that we can turn a fan on."""
|
||||
helper = await setup_test_component(hass, create_fan_service)
|
||||
|
||||
@@ -151,7 +151,7 @@ async def test_turn_on(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_turn_on_off_without_rotation_speed(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_turn_on_off_without_rotation_speed(hass: HomeAssistant) -> None:
|
||||
"""Test that we can turn a fan on."""
|
||||
helper = await setup_test_component(
|
||||
hass, create_fanv2_service_without_rotation_speed
|
||||
@@ -184,7 +184,7 @@ async def test_turn_on_off_without_rotation_speed(hass: HomeAssistant, utcnow) -
|
||||
)
|
||||
|
||||
|
||||
async def test_turn_off(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_turn_off(hass: HomeAssistant) -> None:
|
||||
"""Test that we can turn a fan off."""
|
||||
helper = await setup_test_component(hass, create_fan_service)
|
||||
|
||||
@@ -204,7 +204,7 @@ async def test_turn_off(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_set_speed(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_set_speed(hass: HomeAssistant) -> None:
|
||||
"""Test that we set fan speed."""
|
||||
helper = await setup_test_component(hass, create_fan_service)
|
||||
|
||||
@@ -263,7 +263,7 @@ async def test_set_speed(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_set_percentage(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_set_percentage(hass: HomeAssistant) -> None:
|
||||
"""Test that we set fan speed by percentage."""
|
||||
helper = await setup_test_component(hass, create_fan_service)
|
||||
|
||||
@@ -296,7 +296,7 @@ async def test_set_percentage(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_speed_read(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_speed_read(hass: HomeAssistant) -> None:
|
||||
"""Test that we can read a fans oscillation."""
|
||||
helper = await setup_test_component(hass, create_fan_service)
|
||||
|
||||
@@ -336,7 +336,7 @@ async def test_speed_read(hass: HomeAssistant, utcnow) -> None:
|
||||
assert state.attributes["percentage"] == 0
|
||||
|
||||
|
||||
async def test_set_direction(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_set_direction(hass: HomeAssistant) -> None:
|
||||
"""Test that we can set fan spin direction."""
|
||||
helper = await setup_test_component(hass, create_fan_service)
|
||||
|
||||
@@ -367,7 +367,7 @@ async def test_set_direction(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_direction_read(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_direction_read(hass: HomeAssistant) -> None:
|
||||
"""Test that we can read a fans oscillation."""
|
||||
helper = await setup_test_component(hass, create_fan_service)
|
||||
|
||||
@@ -382,7 +382,7 @@ async def test_direction_read(hass: HomeAssistant, utcnow) -> None:
|
||||
assert state.attributes["direction"] == "reverse"
|
||||
|
||||
|
||||
async def test_fanv2_read_state(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_fanv2_read_state(hass: HomeAssistant) -> None:
|
||||
"""Test that we can read the state of a HomeKit fan accessory."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -397,7 +397,7 @@ async def test_fanv2_read_state(hass: HomeAssistant, utcnow) -> None:
|
||||
assert state.state == "on"
|
||||
|
||||
|
||||
async def test_v2_turn_on(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_turn_on(hass: HomeAssistant) -> None:
|
||||
"""Test that we can turn a fan on."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -472,7 +472,7 @@ async def test_v2_turn_on(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_v2_turn_off(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_turn_off(hass: HomeAssistant) -> None:
|
||||
"""Test that we can turn a fan off."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -492,7 +492,7 @@ async def test_v2_turn_off(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_v2_set_speed(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_set_speed(hass: HomeAssistant) -> None:
|
||||
"""Test that we set fan speed."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -551,7 +551,7 @@ async def test_v2_set_speed(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_v2_set_percentage(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_set_percentage(hass: HomeAssistant) -> None:
|
||||
"""Test that we set fan speed by percentage."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -584,7 +584,7 @@ async def test_v2_set_percentage(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_v2_set_percentage_with_min_step(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_set_percentage_with_min_step(hass: HomeAssistant) -> None:
|
||||
"""Test that we set fan speed by percentage."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service_with_min_step)
|
||||
|
||||
@@ -617,7 +617,7 @@ async def test_v2_set_percentage_with_min_step(hass: HomeAssistant, utcnow) -> N
|
||||
)
|
||||
|
||||
|
||||
async def test_v2_speed_read(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_speed_read(hass: HomeAssistant) -> None:
|
||||
"""Test that we can read a fans oscillation."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -656,7 +656,7 @@ async def test_v2_speed_read(hass: HomeAssistant, utcnow) -> None:
|
||||
assert state.attributes["percentage"] == 0
|
||||
|
||||
|
||||
async def test_v2_set_direction(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_set_direction(hass: HomeAssistant) -> None:
|
||||
"""Test that we can set fan spin direction."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -687,7 +687,7 @@ async def test_v2_set_direction(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_v2_direction_read(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_direction_read(hass: HomeAssistant) -> None:
|
||||
"""Test that we can read a fans oscillation."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -702,7 +702,7 @@ async def test_v2_direction_read(hass: HomeAssistant, utcnow) -> None:
|
||||
assert state.attributes["direction"] == "reverse"
|
||||
|
||||
|
||||
async def test_v2_oscillate(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_oscillate(hass: HomeAssistant) -> None:
|
||||
"""Test that we can control a fans oscillation."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -733,7 +733,7 @@ async def test_v2_oscillate(hass: HomeAssistant, utcnow) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_v2_oscillate_read(hass: HomeAssistant, utcnow) -> None:
|
||||
async def test_v2_oscillate_read(hass: HomeAssistant) -> None:
|
||||
"""Test that we can read a fans oscillation."""
|
||||
helper = await setup_test_component(hass, create_fanv2_service)
|
||||
|
||||
@@ -749,7 +749,7 @@ async def test_v2_oscillate_read(hass: HomeAssistant, utcnow) -> None:
|
||||
|
||||
|
||||
async def test_v2_set_percentage_non_standard_rotation_range(
|
||||
hass: HomeAssistant, utcnow
|
||||
hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test that we set fan speed with a non-standard rotation range."""
|
||||
helper = await setup_test_component(
|
||||
@@ -812,7 +812,7 @@ async def test_v2_set_percentage_non_standard_rotation_range(
|
||||
|
||||
|
||||
async def test_migrate_unique_id(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, utcnow
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test a we can migrate a fan unique id."""
|
||||
aid = get_next_aid()
|
||||
|
||||
Reference in New Issue
Block a user