Ejemplo n.º 1
0
 def test_from_string(self):
     layer = TransportLayerBuilder.build('tcp 1 2 3 4')
     assert_in(TcpAddress.from_string('1 2'), layer.source)
     assert_in(TcpAddress.from_string('3 4'), layer.destination)
     layer = TransportLayerBuilder.build('udp 1-2 3-4')
     assert_in(UdpAddress.from_string('1 2'), layer.source)
     assert_in(UdpAddress.from_string('3 4'), layer.destination)
     layer = TransportLayerBuilder.build('tcp 1-2 3 4')
     assert_in(TcpAddress.from_string('1 2'), layer.source)
     layer = TransportLayerBuilder.build('tcp 1 2')
     assert_in(TcpAddress.from_string('1'), layer.source)
     assert_in(TcpAddress.from_string('2'), layer.destination)
Ejemplo n.º 2
0
 def test_from_string(self):
     layer = TransportLayerBuilder.build('tcp 1 2 3 4')
     assert_in(TcpAddress.from_string('1 2'), layer.source)
     assert_in(TcpAddress.from_string('3 4'), layer.destination)
     layer = TransportLayerBuilder.build('udp 1-2 3-4')
     assert_in(UdpAddress.from_string('1 2'), layer.source)
     assert_in(UdpAddress.from_string('3 4'), layer.destination)
     layer = TransportLayerBuilder.build('tcp 1-2 3 4')
     assert_in(TcpAddress.from_string('1 2'), layer.source)
     layer = TransportLayerBuilder.build('tcp 1 2')
     assert_in(TcpAddress.from_string('1'), layer.source)
     assert_in(TcpAddress.from_string('2'), layer.destination)
Ejemplo n.º 3
0
 def test_not_contains(self):
     udp_port = UdpAddress.from_string('1')
     tcp_ports = TcpAddress.from_string('1-3')
     assert_not_in(udp_port, tcp_ports)
Ejemplo n.º 4
0
 def test_not_contains(self):
     tcp_port = TcpAddress.from_string('1')
     udp_ports = UdpAddress.from_string('1-3')
     assert_not_in(tcp_port, udp_ports)
Ejemplo n.º 5
0
 def test_add_mixed_ports(self):
     group = TransportGroup()
     group.add(TransportAddress.from_string('1-3'))
     group.add(TcpAddress.from_string('1-3'))
     group.add(UdpAddress.from_string('1-3'))
     assert_equals(len(group), 3)
Ejemplo n.º 6
0
 def test_add_mixed_ports(self):
     group = TransportGroup()
     group.add(TransportAddress.from_string('1-3'))
     group.add(TcpAddress.from_string('1-3'))
     group.add(UdpAddress.from_string('1-3'))
     assert_equals(len(group), 3)