Skip to content

Commit

Permalink
Tidying tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andylockran committed Feb 4, 2024
1 parent 27c8110 commit 60d1718
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions tests/test_heatmiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import unittest
from heatmiserv3 import heatmiser
from heatmiserv3 import connection
from heatmiserv3 import crc16
import logging, sys
from heatmiserv3.formats import message

Expand All @@ -25,29 +26,12 @@ def setUp(self):
self.thermo2 = heatmiser.HeatmiserThermostat(2,"prt", self.HeatmiserUH1)
self.thermo3 = heatmiser.HeatmiserThermostat(3,"prt", self.HeatmiserUH1)

def test_message_struct_thermo1(self):
default_message = b'\x01\x0a\x81\x00\x00\x00\xff\xff,\t'
crc = crc16.CRC16()
data = list(default_message)
data = data + crc.run(data)
logging.debug(data)
assert data[0] == 1 ## Thermostat is 1
assert data[1] == 10 ## Read operations
assert data[2] == 129 ## Source address
assert data[3] == 0 ## Read functionCode
assert data[4] == 0 ## Start Address of DCB
assert data[5] == 0 ## Start Address of DCB
assert data[6] == 255 ## End Address of DCB
assert data[7] == 255 ## End Address of DCB
assert data[8] == 44 ## No idea what this is @TODO
assert data[9] == 9 ## No idea what this is @TODO
assert data[10] == 212 ## CRC low
assert data[11] == 141 ## CRC high

def test_thermo3_temperature(self):
""" Initialises the thermo3 thermostat, and checks the temperature is at 21*C"""
# self.thermo3.get_target_temp()
assert self.thermo3.dcb[18] == {'label': 'Set room temp', 'value': 21}

def test_thermo1_temperature(self):
""" Initialises the thermo1 thermostat, and checks the temperature is at 21*C"""

assert self.thermo1.dcb[18]['label'] == 'Set room temp'
assert self.thermo1.dcb[18]['value'] == 21

def tearDown(self):
pass

0 comments on commit 60d1718

Please sign in to comment.