示例#1
0
def test_disable_when_disabled():
    """
    Tests disabling pf when it already disabled.
    """
    ret = {}
    ret["stderr"] = "pfctl: pf not enabled"
    ret["retcode"] = 1
    mock_cmd = MagicMock(return_value=ret)
    with patch.dict(pf.__salt__, {"cmd.run_all": mock_cmd}):
        assert not pf.disable()["changes"]
示例#2
0
 def test_disable_when_enabled(self):
     '''
     Tests disabling pf when it's enabled.
     '''
     ret = {}
     ret['stderr'] = 'pf disabled'
     ret['retcode'] = 0
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(pf.__salt__, {'cmd.run_all': mock_cmd}):
         self.assertTrue(pf.disable()['changes'])
示例#3
0
 def test_disable_when_disabled(self):
     '''
     Tests disabling pf when it already disabled.
     '''
     ret = {}
     ret['stderr'] = 'pfctl: pf not enabled'
     ret['retcode'] = 1
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(pf.__salt__, {'cmd.run_all': mock_cmd}):
         self.assertFalse(pf.disable()['changes'])
示例#4
0
 def test_disable_when_enabled(self):
     """
     Tests disabling pf when it's enabled.
     """
     ret = {}
     ret["stderr"] = "pf disabled"
     ret["retcode"] = 0
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(pf.__salt__, {"cmd.run_all": mock_cmd}):
         self.assertTrue(pf.disable()["changes"])