52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
"""Integration test: Gitea + Vikunja clients."""
|
|
import asyncio
|
|
import sys
|
|
import os
|
|
import io
|
|
|
|
if sys.stdout.encoding != "utf-8":
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from integrations.gitea_client import GiteaClient
|
|
from integrations.vikunja_client import VikunjaClient
|
|
|
|
|
|
async def test_gitea():
|
|
print("=== Gitea API Test ===")
|
|
c = GiteaClient()
|
|
|
|
commits = await c.get_commits(limit=3)
|
|
print(f" Recent commits ({len(commits)}):")
|
|
for x in commits:
|
|
print(f" {x['sha']} {x['message']}")
|
|
|
|
branches = await c.list_branches()
|
|
print(f" Branches: {branches}")
|
|
|
|
prs = await c.list_prs()
|
|
print(f" Open PRs: {len(prs)}")
|
|
print(" Gitea OK")
|
|
|
|
|
|
async def test_vikunja():
|
|
print("\n=== Vikunja API Test ===")
|
|
c = VikunjaClient()
|
|
|
|
tasks = await c.list_tasks("todo")
|
|
print(f" TODO tasks ({len(tasks)}):")
|
|
for t in tasks:
|
|
print(f" #{t['id']} {t['title']}")
|
|
print(" Vikunja OK")
|
|
|
|
|
|
async def main():
|
|
await test_gitea()
|
|
await test_vikunja()
|
|
print("\n All integration tests passed!")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|