|
@@ -1,4 +1,5 @@
|
1
|
1
|
import config
|
|
2
|
+import inspect
|
2
|
3
|
import report
|
3
|
4
|
from tests import testcase, DT_TOGGLE
|
4
|
5
|
import time
|
|
@@ -7,15 +8,19 @@ from unittest.test import equivalency_chk, greater_chk
|
7
|
8
|
|
8
|
9
|
class testcase_heating(testcase):
|
9
|
10
|
def __init__(self, tcl, videv, valve):
|
10
|
|
- self.tcl = tcl
|
|
11
|
+ super().__init__(tcl)
|
11
|
12
|
self.__videv__ = videv
|
12
|
13
|
self.__valve__ = valve
|
13
|
14
|
self.__default_temperature__ = config.DEFAULT_TEMPERATURE.get(self.__valve__.topic)
|
14
|
15
|
self.__test_list__ = ["test_user_temperature_setpoint", "test_default_temperature", "test_summer_mode", "test_away_mode", "test_boost_mode"]
|
15
|
16
|
|
16
|
17
|
def test_user_temperature_setpoint(self, tcel=report.TCEL_FULL):
|
17
|
|
- self.tcl.testCase("User temperature setpoint test for device and virtual device: %s" %
|
18
|
|
- self.__valve__.topic, tcel, self.__test_user_temperature_setpoint__, tcel)
|
|
18
|
+ fname = inspect.currentframe().f_code.co_name
|
|
19
|
+ if tcel != report.TCEL_SMOKE or not self.METHOD_EXECUTED.get(fname, False):
|
|
20
|
+ self.METHOD_EXECUTED[fname] = True
|
|
21
|
+ #
|
|
22
|
+ self.tcl.testCase("User temperature setpoint test for device and virtual device: %s" %
|
|
23
|
+ self.__valve__.topic, tcel, self.__test_user_temperature_setpoint__, tcel)
|
19
|
24
|
|
20
|
25
|
def __test_user_temperature_setpoint__(self, tLogger, tcel):
|
21
|
26
|
mtemp = round(self.__valve__.TEMP_RANGE[0] + (self.__valve__.TEMP_RANGE[1] - self.__valve__.TEMP_RANGE[0]) / 2, 1)
|
|
@@ -38,8 +43,12 @@ class testcase_heating(testcase):
|
38
|
43
|
equivalency_chk(self.__videv__.get(self.__videv__.KEY_VALVE_TEMPERATURE_SETPOINT), setp, tLogger, "Virtual device valve temperature")
|
39
|
44
|
|
40
|
45
|
def test_default_temperature(self, tcel=report.TCEL_FULL):
|
41
|
|
- self.tcl.testCase("Default temperature test for device and virtual device: %s" %
|
42
|
|
- self.__valve__.topic, tcel, self.__test_default_temperature__, tcel)
|
|
46
|
+ fname = inspect.currentframe().f_code.co_name
|
|
47
|
+ if tcel != report.TCEL_SMOKE or not self.METHOD_EXECUTED.get(fname, False):
|
|
48
|
+ self.METHOD_EXECUTED[fname] = True
|
|
49
|
+ #
|
|
50
|
+ self.tcl.testCase("Default temperature test for device and virtual device: %s" %
|
|
51
|
+ self.__valve__.topic, tcel, self.__test_default_temperature__, tcel)
|
43
|
52
|
|
44
|
53
|
def __test_default_temperature__(self, tLogger, tcel):
|
45
|
54
|
dtemp = config.DEFAULT_TEMPERATURE.get(self.__valve__.topic)
|
|
@@ -58,7 +67,11 @@ class testcase_heating(testcase):
|
58
|
67
|
equivalency_chk(self.__valve__.get(self.__valve__.KEY_TEMPERATURE_SETPOINT), dtemp, tLogger, "Valve temperature setpoint")
|
59
|
68
|
|
60
|
69
|
def test_summer_mode(self, tcel=report.TCEL_FULL):
|
61
|
|
- self.tcl.testCase("Summer mode test: %s" % self.__valve__.topic, tcel, self.__test_summer_mode__, tcel)
|
|
70
|
+ fname = inspect.currentframe().f_code.co_name
|
|
71
|
+ if tcel != report.TCEL_SMOKE or not self.METHOD_EXECUTED.get(fname, False):
|
|
72
|
+ self.METHOD_EXECUTED[fname] = True
|
|
73
|
+ #
|
|
74
|
+ self.tcl.testCase("Summer mode test: %s" % self.__valve__.topic, tcel, self.__test_summer_mode__, tcel)
|
62
|
75
|
|
63
|
76
|
def __test_summer_mode__(self, tLogger, tcel):
|
64
|
77
|
self.__videv__.set(self.__videv__.KEY_SET_DEFAULT_TEMPERATURE, None)
|
|
@@ -81,7 +94,11 @@ class testcase_heating(testcase):
|
81
|
94
|
equivalency_chk(self.__valve__.get(self.__valve__.KEY_TEMPERATURE_SETPOINT), vtemp, tLogger, "Temperature setpoint")
|
82
|
95
|
|
83
|
96
|
def test_away_mode(self, tcel=report.TCEL_FULL):
|
84
|
|
- self.tcl.testCase("Away mode test: %s" % self.__valve__.topic, tcel, self.__test_away_mode__, tcel)
|
|
97
|
+ fname = inspect.currentframe().f_code.co_name
|
|
98
|
+ if tcel != report.TCEL_SMOKE or not self.METHOD_EXECUTED.get(fname, False):
|
|
99
|
+ self.METHOD_EXECUTED[fname] = True
|
|
100
|
+ #
|
|
101
|
+ self.tcl.testCase("Away mode test: %s" % self.__valve__.topic, tcel, self.__test_away_mode__, tcel)
|
85
|
102
|
|
86
|
103
|
def __test_away_mode__(self, tLogger, tcel):
|
87
|
104
|
self.__videv__.set(self.__videv__.KEY_SET_DEFAULT_TEMPERATURE, None)
|
|
@@ -104,7 +121,11 @@ class testcase_heating(testcase):
|
104
|
121
|
equivalency_chk(self.__valve__.get(self.__valve__.KEY_TEMPERATURE_SETPOINT), vtemp, tLogger, "Temperature setpoint")
|
105
|
122
|
|
106
|
123
|
def test_boost_mode(self, tcel=report.TCEL_FULL):
|
107
|
|
- self.tcl.testCase("Boost mode test: %s" % self.__valve__.topic, tcel, self.__test_boost_mode__, tcel)
|
|
124
|
+ fname = inspect.currentframe().f_code.co_name
|
|
125
|
+ if tcel != report.TCEL_SMOKE or not self.METHOD_EXECUTED.get(fname, False):
|
|
126
|
+ self.METHOD_EXECUTED[fname] = True
|
|
127
|
+ #
|
|
128
|
+ self.tcl.testCase("Boost mode test: %s" % self.__valve__.topic, tcel, self.__test_boost_mode__, tcel)
|
108
|
129
|
|
109
|
130
|
def __test_boost_mode__(self, tLogger, tcel):
|
110
|
131
|
self.__videv__.set(self.__videv__.KEY_SET_DEFAULT_TEMPERATURE, None)
|