1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00
Files
core/tests/components/coinbase/test_diagnostics.py
Jamie Magee 7688c367cc Remove coinbase v2 API support (#148387)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2025-08-11 16:58:36 +02:00

45 lines
1.3 KiB
Python

"""Test the Coinbase diagnostics."""
from unittest.mock import patch
from syrupy.assertion import SnapshotAssertion
from syrupy.filters import props
from homeassistant.core import HomeAssistant
from .common import (
init_mock_coinbase,
mock_get_exchange_rates,
mock_get_portfolios,
mocked_get_accounts_v3,
)
from tests.components.diagnostics import get_diagnostics_for_config_entry
from tests.typing import ClientSessionGenerator
async def test_entry_diagnostics(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
snapshot: SnapshotAssertion,
) -> None:
"""Test we handle a and redact a diagnostics request."""
with (
patch(
"coinbase.rest.RESTClient.get_portfolios",
return_value=mock_get_portfolios(),
),
patch("coinbase.rest.RESTClient.get_accounts", new=mocked_get_accounts_v3),
patch(
"coinbase.rest.RESTClient.get",
return_value={"data": mock_get_exchange_rates()},
),
):
config_entry = await init_mock_coinbase(hass)
await hass.async_block_till_done()
result = await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
assert result == snapshot(exclude=props("created_at", "modified_at"))