Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: Run tests with coverage
run: |
pytest tests/test_triggers.py -v --cov --cov-branch --cov-report=xml
pytest tests/test_triggers.py tests/test_git_utils.py -v --cov --cov-branch --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand Down
49 changes: 49 additions & 0 deletions tests/test_git_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import pytest
from src.git_utils import (
clean_response,
add_signature_to_comment,
get_github_client,
get_repository,
get_open_issues,
get_issue_comments,
create_issue_comment,
get_issue_details,
search_issues,
write_issue_response,
clone_repository,
update_repository,
get_pr_branch,
get_development_branch,
create_pull_request,
create_pull_request_from_issue,
push_changes_with_authentication,
is_pull_request,
update_self_repo,
perform_github_search,
has_linked_pr,
get_linked_pr
)
from github import Github
from unittest.mock import patch, MagicMock


@patch('src.git_utils.get_github_client')
def test_get_github_client(mock_get_github_client):
mock_get_github_client.return_value = MagicMock(spec=Github)
client = get_github_client()
assert isinstance(client, Github)


def test_clean_response():
response = "This is a test response. "
cleaned_response = clean_response(response)
assert "" not in cleaned_response


def test_add_signature_to_comment():
comment_text = "This is a comment."
model = "test-model"
signed_comment = add_signature_to_comment(comment_text, model)
assert "test-model" in signed_comment

# Add more tests for other functions...
Loading