def setUp(self): self.module = mock.MagicMock() self.module.exit_json.side_effect = AnsibleExitJson self.module.fail_json.side_effect = AnsibleFailJson self.monit = monit.Monit(self.module, 'monit', 'processX', 1) self.monit._status_change_retry_count = 1 mock_sleep = mock.patch('time.sleep') mock_sleep.start() self.addCleanup(mock_sleep.stop)
def test_parse_version(output, expected): module = mock.MagicMock() module.run_command.return_value = (0, output, '') raw_version, version_tuple = monit.Monit(module, '', 'processX', 0)._get_monit_version() assert raw_version == expected
def test_parse_status_supports_all_services(output, expected): status = monit.Monit(None, '', 'processX', 0)._parse_status(output, '') assert status == expected