Initial upload: DevDash CLI with TUI dashboard
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-02-01 06:53:08 +00:00
parent 01f65847c5
commit 7664ac3ac4

View File

@@ -0,0 +1,51 @@
import pytest
from unittest.mock import patch, AsyncMock
from src.api.github import GitHubClient
class TestGitHubClient:
@pytest.mark.asyncio
async def test_get_pull_requests(self):
client = GitHubClient(token="test_token")
mock_prs = [{"number": 1, "title": "Test PR"}]
with patch("httpx.AsyncClient.get", new_callable=AsyncMock) as mock_get:
mock_response = AsyncMock()
mock_response.json.return_value = mock_prs
mock_response.raise_for_status = AsyncMock()
mock_get.return_value = mock_response
prs = await client.get_pull_requests("owner", "repo")
assert len(prs) == 1
assert prs[0]["number"] == 1
@pytest.mark.asyncio
async def test_get_issues(self):
client = GitHubClient(token="test_token")
mock_issues = [{"number": 1, "title": "Test Issue"}]
with patch("httpx.AsyncClient.get", new_callable=AsyncMock) as mock_get:
mock_response = AsyncMock()
mock_response.json.return_value = mock_issues
mock_response.raise_for_status = AsyncMock()
mock_get.return_value = mock_response
issues = await client.get_issues("owner", "repo")
assert len(issues) == 1
@pytest.mark.asyncio
async def test_get_workflows(self):
client = GitHubClient(token="test_token")
mock_workflows = {"workflows": [{"id": 1, "name": "CI"}]}
with patch("httpx.AsyncClient.get", new_callable=AsyncMock) as mock_get:
mock_response = AsyncMock()
mock_response.json.return_value = mock_workflows
mock_response.raise_for_status = AsyncMock()
mock_get.return_value = mock_response
workflows = await client.get_workflows("owner", "repo")
assert len(workflows) == 1