def test_dispatch_issue_empty_comment(self, post_mock, get_mock, log_mock):
"""JiraOutput - Dispatch Success, Empty Comment"""
# setup the request to find an existing issue
get_mock.return_value.status_code = 200
existing_issues = {'issues': [{'fields': {'summary': 'Bogus'}, 'id': '5000'}]}
get_mock.return_value.json.return_value = existing_issues
# setup the auth and successful creation responses
auth_resp = {'session': {'name': 'cookie_name', 'value': 'cookie_value'}}
type(post_mock.return_value).status_code = PropertyMock(side_effect=[200, 200, 200])
post_mock.return_value.json.side_effect = [auth_resp, {}, {'id': 5000}]
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)
评论列表
文章目录