Esempio n. 1
0
 def test_jump(self):
     result = Iptables.table('nat').append("PREROUTING")
     result = result.protocol('tcp')
     result.in_interface('eth1').destination_port(8000).jump('DNAT')
     self.assertEqual(
         "iptables --table nat --append PREROUTING --protocol tcp --in-interface eth1"
         " --destination-port 8000 --jump DNAT", result.preview())
Esempio n. 2
0
 def test_protocol_tcp(self):
     result = Iptables.table('nat').append("PREROUTING")
     result = result.protocol('tcp')
     result.in_interface('eth1')
     self.assertEqual(
         "iptables --table nat --append PREROUTING --protocol tcp --in-interface eth1",
         result.preview())
Esempio n. 3
0
 def test_list(self):
     result = Iptables.list()
     self.assertEqual("iptables --list", result.preview())
Esempio n. 4
0
 def test_delete(self):
     result = Iptables.table('nat').delete()
     self.assertEqual("iptables --table nat --delete", result.preview())
Esempio n. 5
0
 def test_table(self):
     result = Iptables.table('nat')
     self.assertEqual("iptables --table nat", result.preview())
Esempio n. 6
0
 def test_protocol(self):
     result = Iptables.table('nat').append("PREROUTING").protocol('tcp')
     self.assertEqual(
         "iptables --table nat --append PREROUTING --protocol tcp",
         result.preview())
Esempio n. 7
0
 def test_append(self):
     result = Iptables.table('nat').append("PREROUTING")
     self.assertEqual("iptables --table nat --append PREROUTING",
                      result.preview())