def runTest(self): command = AuthenticateCommand( AuthenticateCommand.Request.SERIAL, 123456789) self.assertEqual(command.get(), array.array('B', [0x44, 0x04, 0x01, 0x00, 0x15, 0xcd, 0x5b, 0x7])) command = AuthenticateCommand( AuthenticateCommand.Request.PAIRING, 987654321, map(ord, 'hello')) self.assertEqual(command.get(), array.array('B', [0x44, 0x04, 0x02, 0x05, 0xb1, 0x68, 0xde, 0x3a, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00]))
def authenticate_command(): command = AuthenticateCommand( AuthenticateCommand.Type.REQUEST_SERIAL, 123456789) assert command.get() == array.array('B', [0x44, 0x04, 0x01, 0x00, 0x15, 0xcd, 0x5b, 0x7]) command = AuthenticateCommand( AuthenticateCommand.Type.REQUEST_PAIRING, 987654321, map(ord, 'hello')) assert command.get() == array.array('B', [0x44, 0x04, 0x02, 0x05, 0xb1, 0x68, 0xde, 0x3a, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00])
def runTest(self): command = AuthenticateCommand(AuthenticateCommand.Request.SERIAL, 123456789) self.assertEqual( command.get(), array.array('B', [0x44, 0x04, 0x01, 0x00, 0x15, 0xcd, 0x5b, 0x7])) command = AuthenticateCommand(AuthenticateCommand.Request.PAIRING, 987654321, map(ord, 'hello')) self.assertEqual( command.get(), array.array('B', [ 0x44, 0x04, 0x02, 0x05, 0xb1, 0x68, 0xde, 0x3a, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00 ]))
def test_serial(self): command = AuthenticateCommand(AuthenticateCommand.Request.SERIAL, 123456789) self.assertEqual( command.get(), array.array("B", b"\x44\x04\x01\x00\x15\xCD\x5B\x07"), )
def test_pairing(self): command = AuthenticateCommand( AuthenticateCommand.Request.PAIRING, 987654321, map(ord, 'hello')) self.assertEqual(command.get(), array.array('B', [0x44, 0x04, 0x02, 0x05, 0xb1, 0x68, 0xde, 0x3a, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00]))
def test_pairing(self): command = AuthenticateCommand( AuthenticateCommand.Request.PAIRING, 987654321, map(ord, 'hello')) self.assertEqual(command.get(), array.array('B', [0x44, 0x04, 0x02, 0x05, 0xb1, 0x68, 0xde, 0x3a, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00]))
def test_pairing(self): command = AuthenticateCommand(AuthenticateCommand.Request.PAIRING, 987654321, map(ord, "hello")) self.assertEqual( command.get(), array.array( "B", b"\x44\x04\x02\x05\xB1\x68\xDE\x3A\x68\x65\x6C\x6C\x6F\x00\x00\x00" ), )
def test_serial(self): command = AuthenticateCommand( AuthenticateCommand.Request.SERIAL, 123456789) self.assertEqual(command.get(), array.array('B', [0x44, 0x04, 0x01, 0x00, 0x15, 0xcd, 0x5b, 0x7]))
def test_serial(self): command = AuthenticateCommand(AuthenticateCommand.Request.SERIAL, 123456789) self.assertEqual( command.get(), array.array('B', [0x44, 0x04, 0x01, 0x00, 0x15, 0xcd, 0x5b, 0x7]))