示例#1
0
 def test_response_8000(self):
     msg_data = unhexlify(b'00010001')
     r = responses.R8000(msg_data, 255)
     self.assertEqual(r.status_text(), 'Success')
     msg_data = unhexlify(b'05010001')
     r = responses.R8000(msg_data, 255)
     self.assertEqual(
         r.status_text(),
         'Stack already started (no new configuration accepted)')
     msg_data = unhexlify(b'15010001')
     r = responses.R8000(msg_data, 255)
     self.assertEqual(r.status_text(), 'E_ZCL_ERR_ZTRANSMIT_FAIL')
     msg_data = unhexlify(b'aa010001')
     r = responses.R8000(msg_data, 255)
     self.assertEqual(r.status_text(), 'Failed (ZigBee event codes) 0xaa')
示例#2
0
 def test_jsonResponse(self):
     r = responses.R8000(b'\x00\x00\x00\x01', 255)
     payload = json.dumps(r, cls=core.DeviceEncoder)
     self.assertEqual(payload,
                      '{"status": 0, "sequence": 0, '
                      '"packet_type": 1, "error": "", "lqi": 255}')