def test_check_chain(self):
        '''
        Test if it check for the existence of a chain in the table
        '''
        self.assertEqual(iptables.check_chain(table='filter', chain=None,
                                                   family='ipv4'),
                         'Error: Chain needs to be specified')

        mock_cmd = MagicMock(return_value='')
        with patch.dict(iptables.__salt__, {'cmd.run': mock_cmd}):
            self.assertFalse(iptables.check_chain(table='filter',
                                                       chain='INPUT',
                                                       family='ipv4'))
Beispiel #2
0
    def test_check_chain(self):
        '''
        Test if it check for the existence of a chain in the table
        '''
        self.assertEqual(iptables.check_chain(table='filter', chain=None,
                                                   family='ipv4'),
                         'Error: Chain needs to be specified')

        mock_cmd = MagicMock(return_value='')
        with patch.dict(iptables.__salt__, {'cmd.run': mock_cmd}):
            self.assertFalse(iptables.check_chain(table='filter',
                                                       chain='INPUT',
                                                       family='ipv4'))
    def test_check_chain(self):
        """
        Test if it check for the existence of a chain in the table
        """
        self.assertEqual(
            iptables.check_chain(table="filter", chain=None, family="ipv4"),
            "Error: Chain needs to be specified",
        )

        mock_cmd = MagicMock(return_value="")
        with patch.dict(iptables.__salt__, {"cmd.run": mock_cmd}):
            self.assertFalse(
                iptables.check_chain(table="filter",
                                     chain="INPUT",
                                     family="ipv4"))