mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 22:07:10 +00:00
Add tests for samsungtv diagnostics (#66563)
* Add tests for samsungtv diagnostics * Adjust coveragerc * Adjust type hints Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
ab55e3f1ff
commit
f5ca88b6e4
@ -947,7 +947,6 @@ omit =
|
||||
homeassistant/components/sabnzbd/*
|
||||
homeassistant/components/saj/sensor.py
|
||||
homeassistant/components/samsungtv/bridge.py
|
||||
homeassistant/components/samsungtv/diagnostics.py
|
||||
homeassistant/components/satel_integra/*
|
||||
homeassistant/components/schluter/*
|
||||
homeassistant/components/scrape/sensor.py
|
||||
|
58
tests/components/samsungtv/test_diagnostics.py
Normal file
58
tests/components/samsungtv/test_diagnostics.py
Normal file
@ -0,0 +1,58 @@
|
||||
"""Test samsungtv diagnostics."""
|
||||
from aiohttp import ClientSession
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.components.samsungtv import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.components.samsungtv.test_media_player import MOCK_ENTRY_WS_WITH_MAC
|
||||
|
||||
|
||||
@pytest.fixture(name="config_entry")
|
||||
def get_config_entry(hass: HomeAssistant) -> ConfigEntry:
|
||||
"""Create and register mock config entry."""
|
||||
config_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data=MOCK_ENTRY_WS_WITH_MAC,
|
||||
entry_id="123456",
|
||||
unique_id="any",
|
||||
)
|
||||
config_entry.add_to_hass(hass)
|
||||
return config_entry
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("remotews")
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, hass_client: ClientSession
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
||||
"entry": {
|
||||
"data": {
|
||||
"host": "fake_host",
|
||||
"ip_address": "test",
|
||||
"mac": "aa:bb:cc:dd:ee:ff",
|
||||
"method": "websocket",
|
||||
"name": "fake",
|
||||
"port": 8002,
|
||||
"token": REDACTED,
|
||||
},
|
||||
"disabled_by": None,
|
||||
"domain": "samsungtv",
|
||||
"entry_id": "123456",
|
||||
"options": {},
|
||||
"pref_disable_new_entities": False,
|
||||
"pref_disable_polling": False,
|
||||
"source": "user",
|
||||
"title": "Mock Title",
|
||||
"unique_id": "any",
|
||||
"version": 2,
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user