Skip to content

Commit

Permalink
add fixture for diagnostics test
Browse files Browse the repository at this point in the history
  • Loading branch information
liudger committed Nov 22, 2022
1 parent f30701a commit 6d3c07e
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 113 deletions.
110 changes: 110 additions & 0 deletions tests/components/bsblan/fixtures/diagnostics.json
@@ -0,0 +1,110 @@
{
"info": {
"device_identification": {
"name": "Gerte-Identifikation",
"unit": "",
"desc": "",
"value": "RVS21.831F/127",
"dataType": 7
},
"controller_family": {
"name": "Device family",
"unit": "",
"desc": "",
"value": "211",
"dataType": 0
},
"controller_variant": {
"name": "Device variant",
"unit": "",
"desc": "",
"value": "127",
"dataType": 0
}
},
"device": {
"name": "BSB-LAN",
"version": "1.0.38-20200730234859",
"MAC": "00:80:41:19:69:90",
"uptime": 969402857
},
"state": {
"hvac_mode": {
"name": "Operating mode",
"unit": "",
"desc": "Komfort",
"value": "heat",
"dataType": 1
},
"hvac_mode2": {
"name": "Operating mode",
"unit": "",
"desc": "Reduziert",
"value": "2",
"dataType": 1
},
"target_temperature": {
"name": "Room temperature Comfort setpoint",
"unit": "°C",
"desc": "",
"value": "18.5",
"dataType": 0
},
"target_temperature_high": {
"name": "Komfortsollwert Maximum",
"unit": "°C",
"desc": "",
"value": "23.0",
"dataType": 0
},
"target_temperature_low": {
"name": "Room temp reduced setpoint",
"unit": "°C",
"desc": "",
"value": "17.0",
"dataType": 0
},
"min_temp": {
"name": "Room temp frost protection setpoint",
"unit": "°C",
"desc": "",
"value": "8.0",
"dataType": 0
},
"max_temp": {
"name": "Summer/winter changeover temp heat circuit 1",
"unit": "°C",
"desc": "",
"value": "20.0",
"dataType": 0
},
"hvac_action": {
"name": "Status heating circuit 1",
"unit": "",
"desc": "Raumtemp\u2019begrenzung",
"value": "122",
"dataType": 1
},
"current_temperature": {
"name": "Room temp 1 actual value",
"unit": "°C",
"desc": "",
"value": "18.6",
"dataType": 0
},
"room1_thermostat_mode": {
"name": "Raumthermostat 1",
"unit": "",
"desc": "Kein Bedarf",
"value": "0",
"dataType": 1
},
"outside_temperature": {
"name": "Outside temp sensor local",
"unit": "°C",
"desc": "",
"value": "6.1",
"dataType": 0
}
}
}
123 changes: 10 additions & 113 deletions tests/components/bsblan/test_diagnostics.py
@@ -1,9 +1,11 @@
"""Tests for the diagnostics data provided by the BSBLan integration."""
import json

from aiohttp import ClientSession

from homeassistant.core import HomeAssistant

from tests.common import MockConfigEntry
from tests.common import MockConfigEntry, load_fixture
from tests.components.diagnostics import get_diagnostics_for_config_entry


Expand All @@ -13,115 +15,10 @@ async def test_diagnostics(
init_integration: MockConfigEntry,
):
"""Test diagnostics."""
assert await get_diagnostics_for_config_entry(
hass, hass_client, init_integration
) == {
"info": {
"device_identification": {
"name": "Gerte-Identifikation",
"unit": "",
"desc": "",
"value": "RVS21.831F/127",
"dataType": 7,
},
"controller_family": {
"name": "Device family",
"unit": "",
"desc": "",
"value": "211",
"dataType": 0,
},
"controller_variant": {
"name": "Device variant",
"unit": "",
"desc": "",
"value": "127",
"dataType": 0,
},
},
"device": {
"name": "BSB-LAN",
"version": "1.0.38-20200730234859",
"MAC": "00:80:41:19:69:90",
"uptime": 969402857,
},
"state": {
"hvac_mode": {
"name": "Operating mode",
"unit": "",
"desc": "Komfort",
"value": "heat",
"dataType": 1,
},
"hvac_mode2": {
"name": "Operating mode",
"unit": "",
"desc": "Reduziert",
"value": "2",
"dataType": 1,
},
"target_temperature": {
"name": "Room temperature Comfort setpoint",
"unit": "°C",
"desc": "",
"value": "18.5",
"dataType": 0,
},
"target_temperature_high": {
"name": "Komfortsollwert Maximum",
"unit": "°C",
"desc": "",
"value": "23.0",
"dataType": 0,
},
"target_temperature_low": {
"name": "Room temp reduced setpoint",
"unit": "°C",
"desc": "",
"value": "17.0",
"dataType": 0,
},
"min_temp": {
"name": "Room temp frost protection setpoint",
"unit": "°C",
"desc": "",
"value": "8.0",
"dataType": 0,
},
"max_temp": {
"name": "Summer/winter changeover temp heat circuit 1",
"unit": "°C",
"desc": "",
"value": "20.0",
"dataType": 0,
},
"hvac_action": {
"name": "Status heating circuit 1",
"unit": "",
"desc": "Raumtemp\u2019begrenzung",
"value": "122",
"dataType": 1,
},
"current_temperature": {
"name": "Room temp 1 actual value",
"unit": "°C",
"desc": "",
"value": "18.6",
"dataType": 0,
},
"room1_thermostat_mode": {
"name": "Raumthermostat 1",
"unit": "",
"desc": "Kein Bedarf",
"value": "0",
"dataType": 1,
},
"outside_temperature": {
"name": "Outside temp sensor local",
"unit": "°C",
"desc": "",
"value": "6.1",
"dataType": 0,
},
},
}

diagnostics_fixture = json.loads(load_fixture("bsblan/diagnostics.json"))

assert (
await get_diagnostics_for_config_entry(hass, hass_client, init_integration)
== diagnostics_fixture
)

0 comments on commit 6d3c07e

Please sign in to comment.