Add GiteaClient get_pull_request_comments method #83

Closed
Jmaa wants to merge 3 commits from issue-67-add-giteaclient-getpullrequestcomments-method into main
2 changed files with 12 additions and 7 deletions
Showing only changes of commit 2a365a9a59 - Show all commits

View File

@ -169,7 +169,9 @@ class GiteaClient:
response.raise_for_status()
return response.json()
def get_pull_request_comments(self, owner: str, repo: str, pull_number: int) -> list[dict]:
def get_pull_request_comments(
self, owner: str, repo: str, pull_number: int,
) -> list[dict]:
"""Get comments for a specific pull request.
Args:

View File

@ -1,5 +1,4 @@
import pytest
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch
from aider_gitea.gitea_client import GiteaClient
@ -34,11 +33,13 @@ class TestGiteaClientPRComments:
mock_get.return_value = mock_response
# Call the method
comments = self.client.get_pull_request_comments(self.owner, self.repo, self.pull_number)
comments = self.client.get_pull_request_comments(
self.owner, self.repo, self.pull_number,
)
# Verify the request was made correctly
mock_get.assert_called_once_with(
f'{self.client.gitea_url}/repos/{self.owner}/{self.repo}/pulls/{self.pull_number}/comments'
f'{self.client.gitea_url}/repos/{self.owner}/{self.repo}/pulls/{self.pull_number}/comments',
)
# Verify the response was processed correctly
@ -57,11 +58,13 @@ class TestGiteaClientPRComments:
mock_get.return_value = mock_response
# Call the method
comments = self.client.get_pull_request_comments(self.owner, self.repo, self.pull_number)
comments = self.client.get_pull_request_comments(
self.owner, self.repo, self.pull_number,
)
# Verify the request was made correctly
mock_get.assert_called_once_with(
f'{self.client.gitea_url}/repos/{self.owner}/{self.repo}/pulls/{self.pull_number}/comments'
f'{self.client.gitea_url}/repos/{self.owner}/{self.repo}/pulls/{self.pull_number}/comments',
)
# Verify the response was processed correctly