Example #1
0
    def test_ipset(self):
        """Test ipset tool invocation"""
        # Disable W0212: Test access protected members of admin module.
        # pylint: disable=W0212
        iptables._ipset('foo', 'bar', cmd_input='test')

        treadmill.subproc.invoke.assert_called_with(
            ['ipset', '-exist', 'foo', 'bar'],
            cmd_input='test',
            use_except=True)
Example #2
0
    def test_ipset(self):
        """Test ipset tool invocation"""
        # Disable protected-access: Test access protected members .
        # pylint: disable=protected-access

        treadmill.subproc.invoke.return_value = (123, 'test data')

        res = iptables._ipset('foo', 'bar', cmd_input='test')

        treadmill.subproc.invoke.assert_called_with(['ipset', 'foo', 'bar'],
                                                    cmd_input='test',
                                                    use_except=True)
        self.assertEqual(res, (123, 'test data'))