Beispiel #1
0
    def test_bad_ipv6_prefix_length(self):
        S46RuleOption.parse(bytes.fromhex('00590020011020010203008020010db8000000000000000000000000ffff0000fffe0000'))

        with self.assertRaisesRegex(ValueError, 'range from 0 to 128'):
            S46RuleOption.parse(
                bytes.fromhex('00590021011020010203008120010db800000000000000000000000000ffff0000fffe0000')
            )
Beispiel #2
0
    def test_bad_ipv4_prefix_length(self):
        S46RuleOption.parse(
            bytes.fromhex(
                '00590015011020010203002220010db800ffff0000fffe0000'))

        with self.assertRaisesRegex(ValueError, 'range from 0 to 32'):
            S46RuleOption.parse(
                bytes.fromhex(
                    '00590015011021010203002220010db800ffff0000fffe0000'))
Beispiel #3
0
    def test_bad_option_length(self):
        with self.assertRaisesRegex(ValueError,
                                    'shorter than the minimum length'):
            S46RuleOption.parse(
                bytes.fromhex(
                    '00590000011018010203002220010db800ffff0000fffe0000'))

        with self.assertRaisesRegex(ValueError, 'length does not match'):
            S46RuleOption.parse(
                bytes.fromhex(
                    '00590014011018010203002220010db800ffff0000fffe0000'))
Beispiel #4
0
    def test_bad_option_length(self):
        with self.assertRaisesRegex(ValueError, 'shorter than the minimum length'):
            S46RuleOption.parse(bytes.fromhex('00590000011018010203002220010db800ffff0000fffe0000'))

        with self.assertRaisesRegex(ValueError, 'length does not match'):
            S46RuleOption.parse(bytes.fromhex('00590014011018010203002220010db800ffff0000fffe0000'))