Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.
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