Ejemplo n.º 1
0
 def test_fails_for_non_ipv6_packet(self):
     payload = factory.make_bytes(48)
     packet = make_ipv6_packet(payload=payload, version=5)
     ipv6 = IPv6(packet)
     self.assertThat(ipv6.is_valid(), Equals(False))
     self.assertThat(ipv6.invalid_reason,
                     DocTestMatches("Invalid version..."))
Ejemplo n.º 2
0
 def test_parses_ipv6_packet(self):
     payload = factory.make_bytes(48)
     packet = make_ipv6_packet(payload=payload)
     ipv6 = IPv6(packet)
     self.assertThat(ipv6.is_valid(), Equals(True))
     self.assertThat(ipv6.version, Equals(6))
     self.assertThat(ipv6.packet.payload_length, Equals(len(payload)))
     self.assertThat(ipv6.payload, Equals(payload))
Ejemplo n.º 3
0
 def test_fails_for_truncated_packet(self):
     packet = make_ipv6_packet(truncated=True)
     ipv6 = IPv6(packet)
     self.assertThat(ipv6.is_valid(), Equals(False))
     self.assertThat(ipv6.invalid_reason, DocTestMatches("Truncated..."))