From 2da7720c565f560816a16462eeb6134e9741ee64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sun, 4 Oct 2020 19:51:50 +0100 Subject: Backport the one test that was present in glucometerutils. This also sets up the whole pytest configuration and Travis CI integration. --- freestyle_hid/tests/test_freestyle.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 freestyle_hid/tests/test_freestyle.py (limited to 'freestyle_hid/tests/test_freestyle.py') diff --git a/freestyle_hid/tests/test_freestyle.py b/freestyle_hid/tests/test_freestyle.py new file mode 100644 index 0000000..feb7c15 --- /dev/null +++ b/freestyle_hid/tests/test_freestyle.py @@ -0,0 +1,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"\0\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"} + ), + ) -- cgit v1.2.3