From 67f243713b08e17c5641e5e750cd2266470c933d Mon Sep 17 00:00:00 2001 From: Rogier van Staveren Date: Wed, 26 Jun 2024 16:12:25 +0200 Subject: [PATCH] Add test for command data --- tests/test_unii_command_data.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/test_unii_command_data.py diff --git a/tests/test_unii_command_data.py b/tests/test_unii_command_data.py new file mode 100644 index 0000000..b5757ee --- /dev/null +++ b/tests/test_unii_command_data.py @@ -0,0 +1,25 @@ +# pylint: disable=R0801 +# pylint: disable=missing-function-docstring +""" +Test UNii Command Data helper functions. +""" + +import logging +import unittest + +from unii.unii_command_data import UNiiBypassMode, UNiiBypassUnbypassZoneInput + +_LOGGER = logging.getLogger(__name__) + + +class Test(unittest.TestCase): + """ + Test UNii Command Data helper function correctness. + """ + + def test_bypass_input(self): + data = UNiiBypassUnbypassZoneInput(UNiiBypassMode.USER_CODE, "123456", 1) + self.assertEqual(data.mode, 0) + self.assertEqual(data.code, "12345600") + self.assertEqual(data.number, 1) + self.assertEqual(data.to_bytes(), bytes.fromhex("0012345600000000000001"))