test_jira.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:streamalert 作者: airbnb 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号