コード例 #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")
コード例 #2
0
ファイル: test_ipset.py プロジェクト: vindir/salt
    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'))
コード例 #3
0
ファイル: ipset_test.py プロジェクト: DaveQB/salt
    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'))
コード例 #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"))