Ejemplo n.º 1
0
 def test_reordering_of_jump_rule_comments(self):
     # jump at the start
     self.assertEqual('-m comment --comment "aloha" -j sg-chain',
                      iptables_manager.comment_rule('-j sg-chain', 'aloha'))
     # jump in the middle
     self.assertEqual(
         '-s source -m comment --comment "aloha" -j sg-chain',
         iptables_manager.comment_rule('-s source -j sg-chain', 'aloha'))
     # no jump rule
     self.assertEqual('-s source -m comment --comment "aloha"',
                      iptables_manager.comment_rule('-s source', 'aloha'))
 def test_reordering_of_jump_rule_comments(self):
     # jump at the start
     self.assertEqual(
         '-m comment --comment "aloha" -j sg-chain', iptables_manager.comment_rule("-j sg-chain", "aloha")
     )
     # jump in the middle
     self.assertEqual(
         '-s source -m comment --comment "aloha" -j sg-chain',
         iptables_manager.comment_rule("-s source -j sg-chain", "aloha"),
     )
     # no jump rule
     self.assertEqual('-s source -m comment --comment "aloha"', iptables_manager.comment_rule("-s source", "aloha"))