Beispiel #1
0
    def test_should_convert_bytearray_to_ICMPv6DestinationUnreachable_when_from_bytes_method_is_called(self):
        # GIVEN
        data = any_data()

        # WHEN
        icmpv6_dest_unreachable = ICMPv6DestinationUnreachable.from_bytes(
            io.BytesIO(bytearray([0x00, 0x00, 0x00, 0x00]) + data))

        # THEN
        self.assertEqual(data, icmpv6_dest_unreachable.data)
Beispiel #2
0
    def test_should_convert_bytearray_to_ICMPv6DestinationUnreachable_when_from_bytes_method_is_called(self):
        # GIVEN
        data = any_data()

        # WHEN
        icmpv6_dest_unreachable = ICMPv6DestinationUnreachable.from_bytes(
            io.BytesIO(bytearray([0x00, 0x00, 0x00, 0x00]) + data))

        # THEN
        self.assertEqual(data, icmpv6_dest_unreachable.data)
Beispiel #3
0
    def test_should_convert_ICMPv6DestinationUnreachable_to_bytearray_when_to_bytes_method_is_called(self):
        # GIVEN
        data = any_data()

        icmpv6_dest_unreachable = ICMPv6DestinationUnreachable(data)

        # WHEN
        actual_data = icmpv6_dest_unreachable.to_bytes()

        # THEN
        self.assertEqual(bytearray([0x00, 0x00, 0x00, 0x00]) + data, actual_data)