mirror of
https://github.com/home-assistant/core.git
synced 2025-11-15 22:10:09 +00:00
Ruuvi Gateway integration (#84853)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
30
tests/components/ruuvi_gateway/utils.py
Normal file
30
tests/components/ruuvi_gateway/utils.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""Utilities for ruuvi_gateway tests."""
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from unittest.mock import _patch, patch
|
||||
|
||||
from aioruuvigateway.models import HistoryResponse
|
||||
|
||||
from tests.components.ruuvi_gateway.consts import (
|
||||
ASYNC_SETUP_ENTRY,
|
||||
GATEWAY_MAC,
|
||||
GET_GATEWAY_HISTORY_DATA,
|
||||
)
|
||||
|
||||
|
||||
def patch_gateway_ok() -> _patch:
|
||||
"""Patch gateway function to return valid data."""
|
||||
return patch(
|
||||
GET_GATEWAY_HISTORY_DATA,
|
||||
return_value=HistoryResponse(
|
||||
timestamp=int(time.time()),
|
||||
gw_mac=GATEWAY_MAC,
|
||||
tags=[],
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def patch_setup_entry_ok() -> _patch:
|
||||
"""Patch setup entry to return True."""
|
||||
return patch(ASYNC_SETUP_ENTRY, return_value=True)
|
||||
Reference in New Issue
Block a user