def test_assess_status_active(self):
self.patch_object(chm_core.hookenv, 'status_set')
# disable all of the check functions
self.patch_target('check_if_paused', return_value=(None, None))
self.patch_target('check_interfaces', return_value=(None, None))
self.patch_target('custom_assess_status_check',
return_value=(None, None))
self.patch_target('check_services_running', return_value=(None, None))
self.patch_object(chm_core.hookenv, 'application_version_set')
with mock.patch.object(AssessStatusCharm, 'application_version',
new_callable=mock.PropertyMock,
return_value="abc"):
self.target._assess_status()
self.status_set.assert_called_once_with('active', 'Unit is ready')
self.application_version_set.assert_called_once_with("abc")
# check all the check functions got called
self.check_if_paused.assert_called_once_with()
self.check_interfaces.assert_called_once_with()
self.custom_assess_status_check.assert_called_once_with()
self.check_services_running.assert_called_once_with()
评论列表
文章目录