Use fixtures to setup Axis integration in tests (#86034)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
8e117ee499
commit
332d3e0f19
10 changed files with 491 additions and 485 deletions
|
@ -1,30 +1,22 @@
|
|||
"""Test Axis diagnostics."""
|
||||
|
||||
from copy import deepcopy
|
||||
from unittest.mock import patch
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
|
||||
from .test_device import (
|
||||
API_DISCOVERY_BASIC_DEVICE_INFO,
|
||||
API_DISCOVERY_RESPONSE,
|
||||
setup_axis_integration,
|
||||
)
|
||||
from .const import API_DISCOVERY_BASIC_DEVICE_INFO
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
|
||||
|
||||
async def test_entry_diagnostics(hass, hass_client, config_entry):
|
||||
@pytest.mark.parametrize("api_discovery_items", [API_DISCOVERY_BASIC_DEVICE_INFO])
|
||||
async def test_entry_diagnostics(hass, hass_client, setup_config_entry):
|
||||
"""Test config entry diagnostics."""
|
||||
api_discovery = deepcopy(API_DISCOVERY_RESPONSE)
|
||||
api_discovery["data"]["apiList"].append(API_DISCOVERY_BASIC_DEVICE_INFO)
|
||||
|
||||
with patch.dict(API_DISCOVERY_RESPONSE, api_discovery):
|
||||
await setup_axis_integration(hass, config_entry)
|
||||
|
||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
||||
assert await get_diagnostics_for_config_entry(
|
||||
hass, hass_client, setup_config_entry
|
||||
) == {
|
||||
"config": {
|
||||
"entry_id": config_entry.entry_id,
|
||||
"entry_id": setup_config_entry.entry_id,
|
||||
"version": 3,
|
||||
"domain": "axis",
|
||||
"title": "Mock Title",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue