@patch.object(iptables, '_has_option', MagicMock(return_value=True))
    def test_set_policy(self):
        self.assertEqual(iptables.set_policy(table='filter', chain=None,
                                                   policy=None,
                                                   family='ipv4'),
                         'Error: Chain needs to be specified')

        self.assertEqual(iptables.set_policy(table='filter', chain='INPUT',
                                                   policy=None,
                                                   family='ipv4'),
                         'Error: Policy needs to be specified')

        mock = MagicMock(return_value=True)
        with patch.dict(iptables.__salt__, {'cmd.run': mock}):
            self.assertTrue(iptables.set_policy(table='filter',
                                                       chain='INPUT',
                                                       policy='ACCEPT',
                                                       family='ipv4'))

    # 'save' function tests: 1
Test if it set the current policy for the specified table/chain
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/iptables_test.py/IptablesTestCase.test_set_policy