1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-07 12:37:17 +00:00

require version >= 5.21.0

Prior to this version the status output was different
This commit is contained in:
Simon Kelly 2020-10-15 08:47:27 +02:00
parent 89dbb918a0
commit 8e8ea4eacf
2 changed files with 13 additions and 24 deletions

View file

@ -25,15 +25,15 @@ class MonitTest(unittest.TestCase):
self.module = MagicMock()
self.module.exit_json.side_effect = AnsibleExitJson(Exception)
self.monit = monit.Monit(self.module, 'monit', 'processX', 1)
self.version_patch = mock.patch.object(self.monit, "is_version_higher_than_5_18", return_value=True)
self.version_patch.start()
def tearDown(self):
self.version_patch.stop()
def patch_status(self, side_effect):
return mock.patch.object(self.monit, 'get_status', side_effect=side_effect)
def test_min_version(self):
with mock.patch.object(self.monit, 'monit_version', return_value=(5, 20)):
self.monit.check_version()
self.module.fail_json.assert_called()
def test_change_state_success(self):
with self.patch_status(['not monitored']), self.assertRaises(AnsibleExitJson):
self.monit.stop()