Ejemplo n.º 1
0
    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]))
Ejemplo n.º 2
0
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])
Ejemplo n.º 3
0
    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
            ]))
Ejemplo n.º 4
0
 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"),
     )
Ejemplo n.º 5
0
 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]))
Ejemplo n.º 6
0
 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]))
Ejemplo n.º 7
0
 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"
         ),
     )
Ejemplo n.º 8
0
 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]))
Ejemplo n.º 9
0
 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]))