Example #1
0
 def test_flush(self):
     '''
     Test if it flush the chain in the specified table,
     flush all chains in the specified table if not specified chain.
     '''
     mock_cmd = MagicMock(return_value=True)
     with patch.dict(iptables.__salt__, {'cmd.run': mock_cmd}):
         self.assertTrue(
             iptables.flush(table='filter', chain='INPUT', family='ipv4'))
Example #2
0
 def test_flush(self):
     '''
     Test if it flush the chain in the specified table,
     flush all chains in the specified table if not specified chain.
     '''
     mock_cmd = MagicMock(return_value=True)
     with patch.dict(iptables.__salt__, {'cmd.run': mock_cmd}):
         self.assertTrue(iptables.flush(table='filter',
                                                    chain='INPUT',
                                                    family='ipv4'))
Example #3
0
 def test_flush(self):
     """
     Test if it flush the chain in the specified table,
     flush all chains in the specified table if not specified chain.
     """
     with patch.object(iptables, "_has_option",
                       MagicMock(return_value=True)):
         mock_cmd = MagicMock(return_value=True)
         with patch.dict(iptables.__salt__, {"cmd.run": mock_cmd}):
             self.assertTrue(
                 iptables.flush(table="filter",
                                chain="INPUT",
                                family="ipv4"))