def test_dispatch_success_no_context(self, get_mock, post_mock, log_mock):
"""PagerDutyIncidentOutput - Dispatch Success, No Context"""
# /users, /escalation_policies, /services
type(get_mock.return_value).status_code = PropertyMock(side_effect=[200, 200, 200])
json_user = {'users': [{'id': 'user_id'}]}
json_policy = {'escalation_policies': [{'id': 'policy_id'}]}
json_service = {'services': [{'id': 'service_id'}]}
get_mock.return_value.json.side_effect = [json_user, json_policy, json_service]
# /incidents
post_mock.return_value.status_code = 200
assert_true(self._dispatcher.dispatch(descriptor=self.DESCRIPTOR,
rule_name='rule_name',
alert=get_alert()))
log_mock.assert_called_with('Successfully sent alert to %s', self.SERVICE)
评论列表
文章目录