Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EuleMitKeule committed Feb 6, 2024
1 parent 75871eb commit 8a6472e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/test_thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,35 @@ def on_connection(is_connected: bool):
async def test_get_id(mock_thermostat: Thermostat):
await mock_thermostat.async_connect()

assert mock_thermostat.device_data is None
initial_device_data = mock_thermostat.device_data

from tests.mock_client import mock_id

mock_id.version = 100

await mock_thermostat.async_get_id()

assert mock_thermostat.device_data is not None
assert isinstance(mock_thermostat.device_data.device_serial, Eq3Serial)
assert mock_thermostat.device_data.device_serial == mock_id.serial
assert initial_device_data != mock_thermostat.device_data


@pytest.mark.asyncio
async def test_get_status(mock_thermostat: Thermostat):
await mock_thermostat.async_connect()

assert mock_thermostat.status is None
initial_status = mock_thermostat.status

from tests.mock_client import mock_status

mock_status.valve = 0x0F

await mock_thermostat.async_get_status()

assert mock_thermostat.status is not None
assert mock_thermostat.status.valve == 0x0F
assert initial_status != mock_thermostat.status


@pytest.mark.asyncio
Expand Down Expand Up @@ -175,6 +187,8 @@ async def test_configure_presets(mock_thermostat: Thermostat):
async def test_configure_presets_without_status(mock_thermostat: Thermostat):
await mock_thermostat.async_connect()

mock_thermostat.status = None

with pytest.raises(Exception):
await mock_thermostat.async_configure_presets(
26.5,
Expand Down Expand Up @@ -315,6 +329,8 @@ async def test_set_mode(mock_thermostat: Thermostat):
async def test_set_mode_without_status(mock_thermostat: Thermostat):
await mock_thermostat.async_connect()

mock_thermostat.status = None

with pytest.raises(Exception):
await mock_thermostat.async_set_mode(OperationMode.AUTO)

Expand Down

0 comments on commit 8a6472e

Please sign in to comment.