def testInvalid(self): # we stick to methods in 2.6 for now self.assertEqual(None, DecodeResponse(bytearray())) self.assertEqual(None, DecodeResponse([0])) self.assertEqual(None, DecodeResponse([0, 0, 0])) self.assertEqual(None, DecodeResponse(self.TEST_DATA[0:-1])) self.assertEqual(None, DecodeResponse(self.TEST_DATA[4:])) self.assertEqual(None, DecodeResponse(self.TEST_BAD_DATA))
def VerifyResult(self, response, fields): if self._muting: return self.DUBResponseCode(response.response_code) if (response.response_code == OlaClient.RDM_PLUGIN_DISCOVERY_NOT_SUPPORTED): return if not self.ExpectResponse(): return if len(response.raw_response) != 1: self.SetFailed('Multiple DUB responses returned') return uid = DecodeResponse(bytearray(response.raw_response[0])) if uid is None or uid != self._uid: self.SetFailed('Missing UID in DUB response') self.LogDebug(' Located UID: %s' % uid)
def testValidResponse(self): uid = DecodeResponse(self.TEST_DATA) self.assertNotEqual(None, uid) self.assertEquals(0x00a1, uid.manufacturer_id) self.assertEquals(0x00020020, uid.device_id)