From 8462e24eb9c96bb7500c72221e8aaac8c91bac8c Mon Sep 17 00:00:00 2001 From: Paul Daumlechner Date: Thu, 2 Jul 2020 19:51:00 +0200 Subject: [PATCH] Added frame tests --- pyvlx/frames/frame_reboot.py | 5 ++++- test/frame_gw_reboot_cfm_test.py | 28 ++++++++++++++++++++++++++++ test/frame_gw_reboot_req_test.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 test/frame_gw_reboot_cfm_test.py create mode 100644 test/frame_gw_reboot_req_test.py diff --git a/pyvlx/frames/frame_reboot.py b/pyvlx/frames/frame_reboot.py index b923fd62..4ce08880 100644 --- a/pyvlx/frames/frame_reboot.py +++ b/pyvlx/frames/frame_reboot.py @@ -1,4 +1,4 @@ -"""Module for get version frame classes.""" +"""Module for reboot frame classes.""" from pyvlx.const import Command from .frame import FrameBase @@ -13,6 +13,9 @@ def __init__(self): """Init Frame.""" super().__init__(Command.GW_REBOOT_REQ) + def __str__(self): + """Return human readable string.""" + return '' class FrameGatewayRebootConfirmation(FrameBase): """Frame for response for get version requests.""" diff --git a/test/frame_gw_reboot_cfm_test.py b/test/frame_gw_reboot_cfm_test.py new file mode 100644 index 00000000..65df42a5 --- /dev/null +++ b/test/frame_gw_reboot_cfm_test.py @@ -0,0 +1,28 @@ +"""Unit tests for FrameGatewayRebootConfirmation.""" +import unittest + +from pyvlx.frame_creation import frame_from_raw +from pyvlx.frames import FrameGatewayRebootConfirmation + + +class TestFrameRebootConfirmation(unittest.TestCase): + """Test class FrameSetUTCConfirmation.""" + + # pylint: disable=too-many-public-methods,invalid-name + + EXAMPLE_FRAME = b'\x00\x03\x00\x02\x01' + + def test_bytes(self): + """Test FrameGatewayRebootConfirmation.""" + frame = FrameGatewayRebootConfirmation() + self.assertEqual(bytes(frame), self.EXAMPLE_FRAME) + + def test_frame_from_raw(self): + """Test parse FrameGatewayRebootConfirmation from raw.""" + frame = frame_from_raw(self.EXAMPLE_FRAME) + self.assertTrue(isinstance(frame, FrameGatewayRebootConfirmation)) + + def test_str(self): + """Test string representation of FrameGatewayRebootConfirmation.""" + frame = FrameGatewayRebootConfirmation() + self.assertEqual(str(frame), "") diff --git a/test/frame_gw_reboot_req_test.py b/test/frame_gw_reboot_req_test.py new file mode 100644 index 00000000..1e0e3f4e --- /dev/null +++ b/test/frame_gw_reboot_req_test.py @@ -0,0 +1,28 @@ +"""Unit tests for FrameGatewayRebootRequest.""" +import unittest + +from pyvlx.frame_creation import frame_from_raw +from pyvlx.frames import FrameGatewayRebootRequest + + +class TestFrameRebootRequest(unittest.TestCase): + """Test class FrameGatewayRebootRequest.""" + + # pylint: disable=too-many-public-methods,invalid-name + + EXAMPLE_FRAME = b'\x00\x03\x00\x01\x02' + + def test_bytes(self): + """Test FrameGatewayRebootRequest.""" + frame = FrameGatewayRebootRequest() + self.assertEqual(bytes(frame), self.EXAMPLE_FRAME) + + def test_frame_from_raw(self): + """Test parse FrameGatewayRebootRequest from raw.""" + frame = frame_from_raw(self.EXAMPLE_FRAME) + self.assertTrue(isinstance(frame, FrameGatewayRebootRequest)) + + def test_str(self): + """Test string representation of FrameGatewayRebootRequest.""" + frame = FrameGatewayRebootRequest() + self.assertEqual(str(frame), "")