dhcpkit.tests.ipv6.options.test_option_length module

Test the implementation of option length checking

class dhcpkit.tests.ipv6.options.test_option_length.LengthTestingOption(data: bytes = b'')[source]

Bases: dhcpkit.ipv6.options.Option

Fake DHCPv6 option for testing length checks

load_from(buffer: bytes, offset: int = 0, length: int = None) → int[source]

Load the internal state of this object from the given buffer. The buffer may contain more data after the structured element is parsed. This data is ignored.

Parameters:
  • buffer – The buffer to read data from
  • offset – The offset in the buffer where to start reading
  • length – The amount of data we are allowed to read from the buffer
Returns:

The number of bytes used from the buffer

option_type = 65535
save() → Union[source]

Save the internal state of this object as a buffer.

Returns:The buffer with the data from this element
class dhcpkit.tests.ipv6.options.test_option_length.RelayMessageOptionTestCase(methodName='runTest')[source]

Bases: dhcpkit.tests.ipv6.options.test_option.OptionTestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_bad_option_length()[source]