Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cereal2nd committed Jul 1, 2024
1 parent e7e7065 commit 731a100
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion tests/module_name_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

import pytest
from unittest.mock import MagicMock

from velbusaio.handler import PacketHandler
from velbusaio.messages.memory_data import MemoryDataMessage
Expand All @@ -25,7 +26,9 @@ async def test_module_name(name):
for i, c in enumerate(name):
memory[0xF0 + i] = ord(c)

ph = PacketHandler(None, None)
velbus = MagicMock()
ph = PacketHandler(velbus)
await ph.read_protocol_data()
m = Module(
module_address, module_type, ph.pdata["ModuleTypes"][f"{module_type:02X}"]
)
Expand Down
5 changes: 4 additions & 1 deletion tests/module_status_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pathlib

import pytest
from unittest.mock import MagicMock

from velbusaio.channels import Channel, LightSensor, SelectedProgram
from velbusaio.const import (
Expand Down Expand Up @@ -51,7 +52,9 @@ async def test_module_status_selected_program(module_type):
cache_dir = get_cache_dir()
pathlib.Path(cache_dir).mkdir(parents=True, exist_ok=True)

ph = PacketHandler(None, None)
velbus = MagicMock()
ph = PacketHandler(velbus)
await ph.read_protocol_data()
m = Module(
module_address,
module_type,
Expand Down
6 changes: 5 additions & 1 deletion tests/thermostat_operating_mode_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pathlib

import pytest
from unittest.mock import MagicMock

from velbusaio.channels import Temperature
from velbusaio.controller import Velbus
Expand All @@ -32,7 +33,10 @@ async def test_thermostat_operating_mode(mode, sleep_timer):
cache_dir = get_cache_dir()
pathlib.Path(cache_dir).mkdir(parents=True, exist_ok=True)

ph = PacketHandler(None, None)
velbus = MagicMock()
ph = PacketHandler(velbus)
await ph.read_protocol_data()

m = Module(
module_address,
module_type,
Expand Down

0 comments on commit 731a100

Please sign in to comment.