Fix unit tests

Signed-off-by: Michal Konečný <mkonecny@redhat.com>
This commit is contained in:
Michal Konečný 2022-03-24 17:57:29 +01:00
parent 6a53ce23a0
commit 5d0d0490d2
4 changed files with 10 additions and 9 deletions

View file

@ -86,7 +86,7 @@ class TestProcess:
msg = IssueNewV1()
msg.body = {
"project": {"fullname": scm_request_processor.PROJECT_NAMESPACE},
"issue": {"id": 100, "close_status": "Closed"},
"issue": {"id": 100, "status": "Closed"},
}
with patch(
@ -110,7 +110,7 @@ class TestProcess:
initial processing.
"""
msg = IssueNewV1()
issue = {"id": 100, "close_status": "Open"}
issue = {"id": 100, "status": "Open"}
msg.body = {
"project": {"fullname": scm_request_processor.PROJECT_NAMESPACE},
"issue": issue,
@ -2792,4 +2792,5 @@ class TestMain:
)
message = IssueNewV1()
message.body["issue"] = mock_issue
message.body["project"] = {"fullname": scm_request_processor.PROJECT_NAMESPACE}
mock_process.assert_called_with(config={}, message=message)

View file

@ -244,7 +244,7 @@ class TestPagureAddCommentToIssue:
self.pagure.add_comment_to_issue(issue_id, namespace, message)
self.pagure._requests_session.post.assert_called_with(
"https://pagure.io/test/issue/100/comment",
"https://pagure.io/api/0/test/issue/100/comment",
data={"comment": message},
headers=self.pagure.get_auth_header(),
)
@ -268,7 +268,7 @@ class TestPagureAddCommentToIssue:
self.pagure.add_comment_to_issue(issue_id, namespace, message)
self.pagure._requests_session.post.assert_called_with(
"https://pagure.io/test/issue/100/comment",
"https://pagure.io/api/0/test/issue/100/comment",
data={"comment": message},
headers=self.pagure.get_auth_header(),
)

View file

@ -1058,9 +1058,7 @@ def main(args):
# Convert issue to message
message = IssueNewV1()
message.body["issue"] = issue
message.body["project"] = {
"fullname": PROJECT_NAMESPACE
}
message.body["project"] = {"fullname": PROJECT_NAMESPACE}
_log.debug("Message prepared: {}".format(message.body))
SCMRequestProcessor().process(

View file

@ -176,8 +176,10 @@ class Pagure:
Raises:
toddlers.utils.exceptions.PagureError: When the issue couldn't be commented on.
"""
issue_url = "{0}/api/0/{1}/issue/{2}".format(self._pagure_url, namespace, issue_id)
api_url = "{0}/comment".format(issue_url)
issue_url = "{0}/{1}/issue/{2}".format(self._pagure_url, namespace, issue_id)
api_url = "{0}/api/0/{1}/issue/{2}/comment".format(
self._pagure_url, namespace, issue_id
)
comment_payload = {"comment": comment}
headers = self.get_auth_header()