def test_enable_when_enabled(): """ Tests enabling pf when it already enabled. """ ret = {} ret["stderr"] = "pfctl: pf already enabled" ret["retcode"] = 1 mock_cmd = MagicMock(return_value=ret) with patch.dict(pf.__salt__, {"cmd.run_all": mock_cmd}): assert not pf.enable()["changes"]
def test_enable_when_enabled(self): ''' Tests enabling pf when it already enabled. ''' ret = {} ret['stderr'] = 'pfctl: pf already enabled' ret['retcode'] = 1 mock_cmd = MagicMock(return_value=ret) with patch.dict(pf.__salt__, {'cmd.run_all': mock_cmd}): self.assertFalse(pf.enable()['changes'])
def test_enable_when_disabled(): """ Tests enabling pf when it's not enabled yet. """ ret = {} ret["stderr"] = "pf enabled" ret["retcode"] = 0 mock_cmd = MagicMock(return_value=ret) with patch.dict(pf.__salt__, {"cmd.run_all": mock_cmd}): assert pf.enable()["changes"]
def test_enable_when_disabled(self): ''' Tests enabling pf when it's not enabled yet. ''' ret = {} ret['stderr'] = 'pf enabled' ret['retcode'] = 0 mock_cmd = MagicMock(return_value=ret) with patch.dict(pf.__salt__, {'cmd.run_all': mock_cmd}): self.assertTrue(pf.enable()['changes'])