Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tests for PR#388 #389

Draft
wants to merge 1 commit into
base: adjust-message-copy
Choose a base branch
from
Draft
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
33 changes: 33 additions & 0 deletions tests/unit/torngit/test_github_comments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import pytest
from unittest.mock import AsyncMock, MagicMock
from shared.torngit.github import build_comment_request_body

class TestGithubComments:
@pytest.mark.asyncio
async def test_build_comment_request_body_with_generate_tests_action(self):
# Arrange
comment = "Test comment"
bot_name = "codecov-bot"
is_bot_comment = True
is_pull = True
is_analysis_requested = True
has_commit_data = True
include_button = True
comment_header = "Comment header"
comment_footer = "Comment footer"
repo = MagicMock()

# Act
result = await build_comment_request_body(
comment, bot_name, is_bot_comment, is_pull, is_analysis_requested,
has_commit_data, include_button, comment_header, comment_footer, repo
)

# Assert
assert "actions" in result
assert len(result["actions"]) == 1
action = result["actions"][0]
assert action["name"] == "Generate Tests"
assert action["type"] == "copilot-chat"
assert action["prompt"] == f"@{bot_name} generate tests for PR"
assert result["body"] == f"{comment_header}\n{comment}\n{comment_footer}"
Loading