summaryrefslogtreecommitdiffstats
path: root/freestyle_hid/tests/test_freestyle.py
blob: ebf6b80bf29551b50ac8e1b25810f19864a34259 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# SPDX-FileCopyrightText: © 2019 The freestyle-hid Authors
# SPDX-License-Identifier: Apache-2.0
"""Tests for the common FreeStyle functions.."""

# pylint: disable=protected-access,missing-docstring

import unittest

from freestyle_hid import _session


class TestFreeStyle(unittest.TestCase):
    def test_outgoing_command(self):
        """Test the generation of a new outgoing message."""

        self.assertEqual(
            b"\x17\7command\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
            b"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
            _session._FREESTYLE_MESSAGE.build(
                {"message_type": 23, "command": b"command", "mac": 0}
            ),
        )