Skip to content

Commit

Permalink
Added frame tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pawlizio committed Jul 2, 2020
1 parent 9ab41fb commit 8462e24
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyvlx/frames/frame_reboot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Module for get version frame classes."""
"""Module for reboot frame classes."""
from pyvlx.const import Command

from .frame import FrameBase
Expand All @@ -13,6 +13,9 @@ def __init__(self):
"""Init Frame."""
super().__init__(Command.GW_REBOOT_REQ)

def __str__(self):
"""Return human readable string."""
return '<FrameGatewayRebootRequest/>'

class FrameGatewayRebootConfirmation(FrameBase):
"""Frame for response for get version requests."""
Expand Down
28 changes: 28 additions & 0 deletions test/frame_gw_reboot_cfm_test.py
Original file line number Diff line number Diff line change
@@ -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), "<FrameGatewayRebootConfirmation/>")
28 changes: 28 additions & 0 deletions test/frame_gw_reboot_req_test.py
Original file line number Diff line number Diff line change
@@ -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), "<FrameGatewayRebootRequest/>")

0 comments on commit 8462e24

Please sign in to comment.