Ruuvi Gateway integration (#84853)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Aarni Koskela
2023-01-03 22:19:43 +02:00
committed by GitHub
parent a75bad3a83
commit 38f183a683
23 changed files with 612 additions and 0 deletions

View 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)