@patch.object(iptables, '_has_option', MagicMock(return_value=True))
    @patch.object(iptables, 'check', MagicMock(return_value=False))
    def test_append(self):
        self.assertEqual(iptables.append(table='filter', chain=None,
                                                   rule=None,
                                                   family='ipv4'),
                         'Error: Chain needs to be specified')

        self.assertEqual(iptables.append(table='filter', chain='INPUT',
                                                   rule=None,
                                                   family='ipv4'),
                         'Error: Rule needs to be specified')

        _rule = 'm state --state RELATED,ESTABLISHED -j ACCEPT'
        mock = MagicMock(side_effect=['', 'SALT'])
        with patch.dict(iptables.__salt__, {'cmd.run': mock}):
            self.assertTrue(iptables.append(table='filter', chain='INPUT',
                                            rule=_rule, family='ipv4'))

            self.assertFalse(iptables.append(table='filter', chain='INPUT',
                                            rule=_rule, family='ipv4'))

    # 'insert' function tests: 1
Test if it append a rule to the specified table/chain.
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/iptables_test.py/IptablesTestCase.test_append