test_jira.py 文件源码

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

项目:streamalert 作者: airbnb 项目源码 文件源码
def test_issue_creation_failure(self, post_mock, get_mock, log_mock):
        """JiraOutput - Issue Creation, Failure"""
        # setup the successful search response - no results
        get_mock.return_value.status_code = 200
        get_mock.return_value.json.return_value = {'issues': []}
        # setup successful auth response and failed issue creation
        type(post_mock.return_value).status_code = PropertyMock(side_effect=[200, 400])
        auth_resp = {'session': {'name': 'cookie_name', 'value': 'cookie_value'}}
        post_mock.return_value.content = 'some bad content'
        post_mock.return_value.json.side_effect = [auth_resp, dict()]

        assert_false(self._dispatcher.dispatch(descriptor=self.DESCRIPTOR,
                                               rule_name='rule_name',
                                               alert=get_alert()))

        log_mock.assert_called_with('Failed to send alert to %s', self.SERVICE)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号