mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Move enable_bluetooth fixture to decorator (#118849)
This commit is contained in:
parent
c7e065c413
commit
9c8aa8456e
@ -22,7 +22,8 @@ from . import (
|
||||
from tests.components.bluetooth.test_advertisement_tracker import ONE_HOUR_SECONDS
|
||||
|
||||
|
||||
async def test_tracker_created(hass: HomeAssistant, enable_bluetooth: None) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_tracker_created(hass: HomeAssistant) -> None:
|
||||
"""Test creating a tracker entity when no devices have been seen."""
|
||||
await async_mock_config_entry(hass)
|
||||
|
||||
@ -31,9 +32,8 @@ async def test_tracker_created(hass: HomeAssistant, enable_bluetooth: None) -> N
|
||||
assert state.state == "not_home"
|
||||
|
||||
|
||||
async def test_tracker_ignore_other_rpa(
|
||||
hass: HomeAssistant, enable_bluetooth: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_tracker_ignore_other_rpa(hass: HomeAssistant) -> None:
|
||||
"""Test that tracker ignores RPA's that don't match us."""
|
||||
await async_mock_config_entry(hass)
|
||||
await async_inject_broadcast(hass, MAC_STATIC)
|
||||
@ -43,9 +43,8 @@ async def test_tracker_ignore_other_rpa(
|
||||
assert state.state == "not_home"
|
||||
|
||||
|
||||
async def test_tracker_already_home(
|
||||
hass: HomeAssistant, enable_bluetooth: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_tracker_already_home(hass: HomeAssistant) -> None:
|
||||
"""Test creating a tracker and the device was already discovered by HA."""
|
||||
await async_inject_broadcast(hass, MAC_RPA_VALID_1)
|
||||
await async_mock_config_entry(hass)
|
||||
@ -55,7 +54,8 @@ async def test_tracker_already_home(
|
||||
assert state.state == "home"
|
||||
|
||||
|
||||
async def test_tracker_arrive_home(hass: HomeAssistant, enable_bluetooth: None) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_tracker_arrive_home(hass: HomeAssistant) -> None:
|
||||
"""Test transition from not_home to home."""
|
||||
await async_mock_config_entry(hass)
|
||||
await async_inject_broadcast(hass, MAC_RPA_VALID_1, b"1")
|
||||
@ -85,7 +85,8 @@ async def test_tracker_arrive_home(hass: HomeAssistant, enable_bluetooth: None)
|
||||
assert state.attributes["current_address"] == "40:01:02:0a:c4:a6"
|
||||
|
||||
|
||||
async def test_tracker_isolation(hass: HomeAssistant, enable_bluetooth: None) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_tracker_isolation(hass: HomeAssistant) -> None:
|
||||
"""Test creating 2 tracker entities doesn't confuse anything."""
|
||||
await async_mock_config_entry(hass)
|
||||
await async_mock_config_entry(hass, irk="1" * 32)
|
||||
@ -102,7 +103,8 @@ async def test_tracker_isolation(hass: HomeAssistant, enable_bluetooth: None) ->
|
||||
assert state.state == "not_home"
|
||||
|
||||
|
||||
async def test_tracker_mac_rotate(hass: HomeAssistant, enable_bluetooth: None) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_tracker_mac_rotate(hass: HomeAssistant) -> None:
|
||||
"""Test MAC address rotation."""
|
||||
await async_inject_broadcast(hass, MAC_RPA_VALID_1)
|
||||
await async_mock_config_entry(hass)
|
||||
@ -119,7 +121,8 @@ async def test_tracker_mac_rotate(hass: HomeAssistant, enable_bluetooth: None) -
|
||||
assert state.attributes["current_address"] == MAC_RPA_VALID_2
|
||||
|
||||
|
||||
async def test_tracker_start_stale(hass: HomeAssistant, enable_bluetooth: None) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_tracker_start_stale(hass: HomeAssistant) -> None:
|
||||
"""Test edge case where we find an existing stale record, and it expires before we see any more."""
|
||||
time.monotonic()
|
||||
|
||||
@ -138,7 +141,8 @@ async def test_tracker_start_stale(hass: HomeAssistant, enable_bluetooth: None)
|
||||
assert state.state == "not_home"
|
||||
|
||||
|
||||
async def test_tracker_leave_home(hass: HomeAssistant, enable_bluetooth: None) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_tracker_leave_home(hass: HomeAssistant) -> None:
|
||||
"""Test tracker notices we have left."""
|
||||
time.monotonic()
|
||||
|
||||
@ -157,9 +161,8 @@ async def test_tracker_leave_home(hass: HomeAssistant, enable_bluetooth: None) -
|
||||
assert state.state == "not_home"
|
||||
|
||||
|
||||
async def test_old_tracker_leave_home(
|
||||
hass: HomeAssistant, enable_bluetooth: None
|
||||
) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_old_tracker_leave_home(hass: HomeAssistant) -> None:
|
||||
"""Test tracker ignores an old stale mac address timing out."""
|
||||
start_time = time.monotonic()
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.ruuvitag_ble.const import DOMAIN
|
||||
from homeassistant.components.sensor import ATTR_STATE_CLASS
|
||||
from homeassistant.const import ATTR_FRIENDLY_NAME, ATTR_UNIT_OF_MEASUREMENT
|
||||
@ -13,7 +15,8 @@ from tests.common import MockConfigEntry
|
||||
from tests.components.bluetooth import inject_bluetooth_service_info
|
||||
|
||||
|
||||
async def test_sensors(enable_bluetooth: None, hass: HomeAssistant) -> None:
|
||||
@pytest.mark.usefixtures("enable_bluetooth")
|
||||
async def test_sensors(hass: HomeAssistant) -> None:
|
||||
"""Test the RuuviTag BLE sensors."""
|
||||
entry = MockConfigEntry(domain=DOMAIN, unique_id=RUUVITAG_SERVICE_INFO.address)
|
||||
entry.add_to_hass(hass)
|
||||
|
Loading…
x
Reference in New Issue
Block a user