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_ineqaulity(self):
     ace = Ace()
     ace.network = NetworkLayer.from_string('1.2.3.0/24 2.3.4.0/24')
     ace.transport = TransportLayerBuilder.build('tcp 1024 65535 22 22')
     ace.logging = LoggingFacility.from_string('warning')
     assert_not_equals(Ace(), ace)
     assert_not_equals(Ace(permit=False), Ace())
     assert_not_equals(Ace(logging=1), Ace())
     ace = Ace()
     ace.network = NetworkLayer.from_string('1.2.3.0/24 2.3.4.0/24')
     assert_not_equals(ace, Ace())
     ace = Ace()
     ace.transport = TransportLayerBuilder.build('tcp 1024 65535 22 22')
     assert_not_equals(ace, Ace())
Ejemplo n.º 4
0
 def test_ineqaulity(self):
     ace = Ace()
     ace.network = NetworkLayer.from_string('1.2.3.0/24 2.3.4.0/24')
     ace.transport = TransportLayerBuilder.build('tcp 1024 65535 22 22')
     ace.logging = LoggingFacility.from_string('warning')
     assert_not_equals(Ace(), ace)
     assert_not_equals(Ace(permit=False), Ace())
     assert_not_equals(Ace(logging=1), Ace())
     ace = Ace()
     ace.network = NetworkLayer.from_string('1.2.3.0/24 2.3.4.0/24')
     assert_not_equals(ace, Ace())
     ace = Ace()
     ace.transport = TransportLayerBuilder.build('tcp 1024 65535 22 22')
     assert_not_equals(ace, Ace())
Ejemplo n.º 5
0
 def test_not_contains(self):
     ace = Ace(network=NetworkLayer.from_string('1.2.3.0/24 2.3.4.0/24'))
     assert_not_in(Ace(), ace)
     ace = Ace(transport=TransportLayerBuilder.build('tcp 1024 65535 22 22'))
     assert_not_in(Ace(), ace)
     ace = Ace(logging='warning')
     assert_not_in(Ace(), ace)
Ejemplo n.º 6
0
 def test_not_contains(self):
     ace = Ace(network=NetworkLayer.from_string('1.2.3.0/24 2.3.4.0/24'))
     assert_not_in(Ace(), ace)
     ace = Ace(
         transport=TransportLayerBuilder.build('tcp 1024 65535 22 22'))
     assert_not_in(Ace(), ace)
     ace = Ace(logging='warning')
     assert_not_in(Ace(), ace)
Ejemplo n.º 7
0
 def test_eqaulity(self):
     aces = list()
     for index in range(2):
         ace = Ace()
         ace.network = NetworkLayer.from_string('1.2.3.0/24 2.3.4.0/24')
         ace.transport = TransportLayerBuilder.build('tcp 1024 65535 22 22')
         ace.logging = LoggingFacility.from_string('warning')
         aces.append(ace)
     assert_equals(aces[0], aces[1])
Ejemplo n.º 8
0
 def test_eqaulity(self):
     aces = list()
     for index in range(2):
         ace = Ace()
         ace.network = NetworkLayer.from_string('1.2.3.0/24 2.3.4.0/24')
         ace.transport = TransportLayerBuilder.build('tcp 1024 65535 22 22')
         ace.logging = LoggingFacility.from_string('warning')
         aces.append(ace)
     assert_equals(aces[0], aces[1])
Ejemplo n.º 9
0
 def transport(self, value):
     if value is not None:
         value = TransportLayerBuilder.build(value)
     self._transport = value
Ejemplo n.º 10
0
 def test_transport_setter(self):
     self.ace.transport = None
     assert_equals(self.ace.transport, None)
     nl = TransportLayerBuilder.build('tcp 1 2 3 4')
     self.ace.transport = TransportLayerBuilder.build('tcp 1 2 3 4')
     assert_in(nl, self.ace.transport)
Ejemplo n.º 11
0
 def test_transport_setter(self):
     self.ace.transport = None
     assert_equals(self.ace.transport, None)
     nl = TransportLayerBuilder.build('tcp 1 2 3 4')
     self.ace.transport = TransportLayerBuilder.build('tcp 1 2 3 4')
     assert_in(nl, self.ace.transport)