def test_load(self): ''' Tests loading ruleset. ''' ret = {} ret['retcode'] = 0 mock_cmd = MagicMock(return_value=ret) with patch.dict(pf.__salt__, {'cmd.run_all': mock_cmd}): res = pf.load() mock_cmd.assert_called_once_with(['pfctl', '-f', '/etc/pf.conf'], output_loglevel='trace', python_shell=False) self.assertTrue(res['changes'])
def test_load(): """ Tests loading ruleset. """ ret = {} ret["retcode"] = 0 mock_cmd = MagicMock(return_value=ret) with patch.dict(pf.__salt__, {"cmd.run_all": mock_cmd}): res = pf.load() mock_cmd.assert_called_once_with( ["pfctl", "-f", "/etc/pf.conf"], output_loglevel="trace", python_shell=False, ) assert res["changes"]
def test_load_noop(self): """ Tests evaluating but not actually loading ruleset. """ ret = {} ret["retcode"] = 0 mock_cmd = MagicMock(return_value=ret) with patch.dict(pf.__salt__, {"cmd.run_all": mock_cmd}): res = pf.load(noop=True) mock_cmd.assert_called_once_with( ["pfctl", "-f", "/etc/pf.conf", "-n"], output_loglevel="trace", python_shell=False, ) self.assertFalse(res["changes"])