def test_fetch_query_results_with_errors(settings, jira):
"""JIRA responses with error messages should be logged and returned."""
settings.JIRA_AUTH = ("user", "password")
expected = dict(
errors=[],
errorMessages=["Was a boring conversation anyway... Luke we're gonna have company!", ],
)
expected_json = json.dumps(expected)
with requests_mock.mock() as m:
with patch("dashboard.services.jira.LOGGER") as mocked_logger:
m.register_uri(requests_mock.ANY, requests_mock.ANY, text=expected_json)
result = jira.fetch_query_results(43035, logger=mocked_logger)
assert mocked_logger.warning.called
assert result == expected
test_services_jira.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录