Example #1
0
def test_flush():
    """
    Test for Flush entries in the specified set
    """
    mock = MagicMock(side_effect=["", "A"])
    with patch.dict(ipset.__salt__, {"cmd.run": mock}):
        assert ipset.flush("set")
        assert not ipset.flush("set")
Example #2
0
    def test_flush(self):
        '''
        Test for Flush entries in the specified set
        '''
        with patch.object(ipset, '_find_set_type', return_value=None):
            self.assertEqual(ipset.flush('set'),
                             'Error: Set set does not exist')

        with patch.object(ipset, '_find_set_type', return_value=True):
            mock = MagicMock(side_effect=['', 'A'])
            with patch.dict(ipset.__salt__, {'cmd.run': mock}):
                self.assertTrue(ipset.flush('set'))
                self.assertFalse(ipset.flush('set'))
Example #3
0
    def test_flush(self):
        '''
        Test for Flush entries in the specified set
        '''
        with patch.object(ipset, '_find_set_type', return_value=None):
            self.assertEqual(ipset.flush('set'),
                             'Error: Set set does not exist')

        with patch.object(ipset, '_find_set_type', return_value=True):
            mock = MagicMock(side_effect=['', 'A'])
            with patch.dict(ipset.__salt__, {'cmd.run': mock}):
                self.assertTrue(ipset.flush('set'))
                self.assertFalse(ipset.flush('set'))
Example #4
0
    def test_flush(self):
        """
        Test for Flush entries in the specified set
        """
        with patch.object(ipset, "_find_set_type", return_value=None):
            self.assertEqual(ipset.flush("set"),
                             "Error: Set set does not exist")

        with patch.object(ipset, "_find_set_type", return_value=True):
            mock = MagicMock(side_effect=["", "A"])
            with patch.dict(ipset.__salt__, {"cmd.run": mock}):
                self.assertTrue(ipset.flush("set"))
                self.assertFalse(ipset.flush("set"))