Files
gitea-platform-mcp/tests/unit/test_notifications.py
T
a-limasov-ii db5a43b19a refactor: make gitea a self-contained Cline skill
Relocate the script into the skill (skills/gitea/scripts/gitea_mcp.py) and add a
PEP 723 dependency block, so `uv run scripts/gitea_mcp.py` provisions deps with no
install step and the skill folder is portable (drop into ~/.cline/skills/). Drop
the non-standard `metadata` frontmatter — Cline only recognizes name + description.

- .mcp.json points at the relocated script and runs with --no-project (PEP 723)
- SKILL.md uses relative scripts/ paths; metadata block removed
- find_config walks up the tree to locate config.json (skill root or plugin root)
- tests import gitea_mcp via pytest pythonpath; README/CLAUDE paths updated

Tests: 119 passed, 92% coverage. Standalone list-tools verified via uv --no-project.
2026-06-24 14:35:28 +03:00

48 lines
1.3 KiB
Python

import json
import pytest
import httpx
import respx
from gitea_mcp import list_notifications, mark_all_notifications_read
BASE = "https://gitea.test/api/v1"
@respx.mock
def test_list_notifications_defaults():
route = respx.get(f"{BASE}/notifications").mock(
return_value=httpx.Response(200, json=[{"id": 1, "unread": True}])
)
result = list_notifications()
assert route.called
params = dict(route.calls[0].request.url.params)
assert params["limit"] == "20"
assert params["all"] == "false"
@respx.mock
def test_list_notifications_include_read():
route = respx.get(f"{BASE}/notifications").mock(
return_value=httpx.Response(200, json=[])
)
list_notifications(include_read=True)
params = dict(route.calls[0].request.url.params)
assert params["all"] == "true"
@respx.mock
def test_list_notifications_error():
respx.get(f"{BASE}/notifications").mock(
return_value=httpx.Response(401, json={"message": "unauthorized"})
)
with pytest.raises(RuntimeError, match="401"):
list_notifications()
@respx.mock
def test_mark_all_notifications_read():
route = respx.put(f"{BASE}/notifications").mock(
return_value=httpx.Response(205)
)
result = mark_all_notifications_read()
assert route.called