5656
5757class TestControllerCommand (TestApi ):
5858
59- def test_010_command_send_node_information_nodeid_2 (self ):
60- self .wipTest ()
61- ret = self .network .controller .begin_command_send_node_information (2 )
59+ def setUp (self ):
60+ self .max_delay = 30
61+ self .ctrl_command_result = None
62+ dispatcher .connect (self .ctrl_message , ZWaveController .SIGNAL_CONTROLLER )
63+ self .node_result = None
64+ dispatcher .connect (self .node_update , ZWaveNetwork .SIGNAL_NODE )
65+
66+ def tearDown (self ):
67+ self .network .controller .cancel_command ()
68+ dispatcher .disconnect (self .ctrl_message , ZWaveController .SIGNAL_CONTROLLER )
69+ dispatcher .disconnect (self .node_update , ZWaveNetwork .SIGNAL_NODE )
70+
71+ def test_010_command_send_node_information_nodeid (self ):
72+ node_id = max (self .network .nodes .keys ())
73+ ret = self .network .controller .begin_command_send_node_information (node_id )
6274 self .assertTrue (ret )
6375 current = None
64- for i in range (0 ,SLEEP * 3 ):
76+ for i in range (0 ,SLEEP * 2 ):
6577 #print("self.ctrl_command_result = %s" % self.ctrl_command_result)
6678 if self .ctrl_command_result != None and self .ctrl_command_result != "InProgress" :
6779 current = self .ctrl_command_result
@@ -72,12 +84,12 @@ def test_010_command_send_node_information_nodeid_2(self):
7284 time .sleep (1.0 )
7385 self .assertEqual (current , "Completed" )
7486
75- def test_020_command_send_node_information_nodeid_1 (self ):
76- self .wipTest ()
77- ret = self .network .controller .begin_command_send_node_information (1 )
87+ def test_020_command_send_node_information_nodeid_controller (self ):
88+ node_id = self .network . controller . node_id
89+ ret = self .network .controller .begin_command_send_node_information (node_id )
7890 self .assertTrue (ret )
7991 current = None
80- for i in range (0 ,SLEEP * 3 ):
92+ for i in range (0 ,SLEEP * 2 ):
8193 #print("self.ctrl_command_result = %s" % self.ctrl_command_result)
8294 if self .ctrl_command_result != None and self .ctrl_command_result != "InProgress" :
8395 current = self .ctrl_command_result
@@ -86,14 +98,14 @@ def test_020_command_send_node_information_nodeid_1(self):
8698 break
8799 else :
88100 time .sleep (1.0 )
89- self .assertEqual (current , "Completed " )
101+ self .assertEqual (current , "Failed " )
90102
91103 def test_110_command_request_network_update (self ):
92104 self .wipTest ()
93105 ret = self .network .controller .begin_command_request_network_update ()
94106 self .assertTrue (ret )
95107 current = None
96- for i in range (0 ,SLEEP * 3 ):
108+ for i in range (0 ,SLEEP * 2 ):
97109 #print("self.ctrl_command_result = %s" % self.ctrl_command_result)
98110 if self .ctrl_command_result != None and self .ctrl_command_result != "InProgress" :
99111 current = self .ctrl_command_result
@@ -105,11 +117,11 @@ def test_110_command_request_network_update(self):
105117 self .assertEqual (current , "Completed" )
106118
107119 def test_210_command_request_node_neigbhor_update_node (self ):
108- self .wipTest ( )
109- ret = self .network .controller .begin_command_request_node_neigbhor_update (2 )
120+ node_id = max ( self .network . nodes . keys () )
121+ ret = self .network .controller .begin_command_request_node_neigbhor_update (node_id )
110122 self .assertTrue (ret )
111123 current = None
112- for i in range (0 ,SLEEP * 3 ):
124+ for i in range (0 ,SLEEP * 2 ):
113125 #print("self.ctrl_command_result = %s" % self.ctrl_command_result)
114126 if self .ctrl_command_result != None and self .ctrl_command_result != "InProgress" :
115127 current = self .ctrl_command_result
@@ -121,11 +133,11 @@ def test_210_command_request_node_neigbhor_update_node(self):
121133 self .assertEqual (current , "Completed" )
122134
123135 def test_220_command_request_node_neigbhor_update_controller (self ):
124- self .wipTest ()
125- ret = self .network .controller .begin_command_request_node_neigbhor_update (1 )
136+ node_id = self .network . controller . node_id
137+ ret = self .network .controller .begin_command_request_node_neigbhor_update (node_id )
126138 self .assertTrue (ret )
127139 current = None
128- for i in range (0 ,SLEEP * 3 ):
140+ for i in range (0 ,SLEEP * 2 ):
129141 #print("self.ctrl_command_result = %s" % self.ctrl_command_result)
130142 if self .ctrl_command_result != None and self .ctrl_command_result != "InProgress" :
131143 current = self .ctrl_command_result
@@ -134,14 +146,32 @@ def test_220_command_request_node_neigbhor_update_controller(self):
134146 break
135147 else :
136148 time .sleep (1.0 )
137- self .assertEqual (current , "Failed " )
149+ self .assertEqual (current , "Completed " )
138150
139151 def test_910_command_command_replication_send (self ):
140152 self .wipTest ()
141- ret = self .network .controller .begin_command_replication_send (1 )
153+ node_id = max (self .network .nodes .keys ())
154+ ret = self .network .controller .begin_command_replication_send (node_id )
155+ self .assertTrue (ret )
156+ current = None
157+ for i in range (0 ,SLEEP * 2 ):
158+ #print("self.ctrl_command_result = %s" % self.ctrl_command_result)
159+ if self .ctrl_command_result != None and self .ctrl_command_result != "InProgress" :
160+ current = self .ctrl_command_result
161+ print (current )
162+ self .ctrl_command_result = None
163+ break
164+ else :
165+ time .sleep (1.0 )
166+ self .assertEqual (current , "Completed" )
167+
168+ def test_920_command_command_replication_send_controller (self ):
169+ self .wipTest ()
170+ node_id = self .network .controller .node_id
171+ ret = self .network .controller .begin_command_replication_send (node_id )
142172 self .assertTrue (ret )
143173 current = None
144- for i in range (0 ,SLEEP * 3 ):
174+ for i in range (0 ,SLEEP * 2 ):
145175 #print("self.ctrl_command_result = %s" % self.ctrl_command_result)
146176 if self .ctrl_command_result != None and self .ctrl_command_result != "InProgress" :
147177 current = self .ctrl_command_result
0 commit comments