From 75016f73fde8afcf318fa84c1abbae84dd345104 Mon Sep 17 00:00:00 2001 From: Jacob Tomlinson Date: Mon, 9 May 2016 16:20:57 +0100 Subject: [PATCH] Added tests --- RFXtrx/__init__.py | 5 +++-- tests/test_base.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/RFXtrx/__init__.py b/RFXtrx/__init__.py index 640e3ea..f151105 100644 --- a/RFXtrx/__init__.py +++ b/RFXtrx/__init__.py @@ -124,10 +124,11 @@ def send_off(self, transport): self.send_onoff(transport, False) def send_openclosestop(self, transport, command): - """ Send an 'Open' or a 'Close' or a 'Stop' command using the given transport """ + """ Send an 'Open' or a 'Close' or a 'Stop' command + using the given transport """ if self.packettype == 0x14: # Lighting5 if command not in [0x0d, 0x0e, 0x0f]: - raise ValueError(command, "is not an 'open', 'close' or 'stop' packet in Lighting5") + raise ValueError(command, "is not a relay packet in Lighting5") pkt = lowlevel.Lighting5() pkt.set_transmit(self.subtype, 0, self.id_combined, self.unitcode, command, 0x00) diff --git a/tests/test_base.py b/tests/test_base.py index 614b017..370d66d 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -72,6 +72,10 @@ def test_format_packet(self): event = core.transport.parse(bytes_array) event.device.send_on(core.transport) event.device.send_off(core.transport) + event.device.send_open(core.transport) + event.device.send_close(core.transport) + event.device.send_stop(core.transport) + self.assertRaises(ValueError,event.device.send_openclosestop,core.transport,0x0c) self.assertRaises(ValueError,event.device.send_dim,core.transport,150) self.assertRaises(ValueError,event.device.send_dim,core.transport,-1) event.device.send_dim(core.transport,50) @@ -324,5 +328,3 @@ def test_receive(self): self.assertEquals(RFXtrx.StatusEvent, type(event)) self.assertEquals(event.__str__()," device=[Status [subtype=433.92MHz, firmware=69, devices=['ac', 'arc', 'hideki', 'homeeasy', 'lacrosse', 'oregon', 'x10']]]") core.close_connection() - - \ No newline at end of file