Source code for dhcpkit.tests.ipv6.extensions.test_linklayer_id

"""
Test the RemoteIdOption implementation
"""
import unittest

from dhcpkit.ipv6.extensions.linklayer_id import LinkLayerIdOption
from dhcpkit.tests.ipv6.options import test_option


[docs]class LinkLayerIdOptionTestCase(test_option.OptionTestCase):
[docs] def setUp(self): self.option_bytes = bytes.fromhex('004f00080001002436ef1d89') self.option_object = LinkLayerIdOption(1, bytes.fromhex('002436ef1d89')) self.parse_option()
[docs] def test_display(self): output = str(self.option_object) self.assertEqual(output, "LinkLayerIdOption(\n" " link_layer_type=Ethernet (1),\n" " link_layer_address=b'\\x00$6\\xef\\x1d\\x89',\n" ")")
[docs] def test_bad_option_length(self): with self.assertRaisesRegex(ValueError, 'longer than the available buffer'): LinkLayerIdOption.parse(bytes.fromhex('004f00090001002436ef1d89'))
if __name__ == '__main__': # pragma: no cover unittest.main()