test: dedizierter mcptest-User statt Stefans echter Daten
USER_ALIASES test->mcptest. Eigene Backends pro Dienst: - Radicale-User mcptest + /mcptest/calendar-test + contacts-test - oCIS-User mcptest (Graph-API), Joplin lokales Profil :41186 - statische Test-Maildir tests/testdata/maildir (mcp-test-mail/-empty) test_all.py auf mcptest-Backends umgestellt (Account-/Kalender-/Kontaktnamen). config.json (gitignored) mit mcptest in allen Maps. Doku: tests/MCPTEST.md. 54 Tests gruen. Stefans calendar-test/contacts-test + Joplin-Test-Reste entfernt.
This commit is contained in:
+12
-12
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""MCP Server Integration Tests.
|
||||
|
||||
Uses a 'test' OAuth client (maps to stefan's data).
|
||||
Uses a 'test' OAuth client (maps to dedicated mcptest backends).
|
||||
Creates, reads, updates, and deletes test data in dedicated test collections:
|
||||
- Radicale: calendar-test, contacts-test
|
||||
- oCIS: /mcp-tests/
|
||||
@@ -133,10 +133,10 @@ class TestMail:
|
||||
|
||||
def test_list_accounts(self):
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "list_accounts")
|
||||
assert "d370128_0-slohmaier" in text
|
||||
assert "mcp-test-mail" in text
|
||||
|
||||
def test_list_folders(self):
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "list_folders", {"account": "d370128_0-slohmaier"})
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "list_folders", {"account": "mcp-test-mail"})
|
||||
assert "INBOX" in text
|
||||
|
||||
def test_search_finds_something(self):
|
||||
@@ -145,13 +145,13 @@ class TestMail:
|
||||
|
||||
def test_search_empty_result(self):
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "search_mail",
|
||||
{"query": "xyzzy_nonexistent_99", "limit": 1, "account": "d370128_0-gitea"})
|
||||
{"query": "xyzzy_nonexistent_99", "limit": 1, "account": "mcp-test-empty"})
|
||||
assert "No results" in text
|
||||
|
||||
def test_read_mail(self):
|
||||
# First search to get a key
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "search_mail",
|
||||
{"query": "stefan", "limit": 1, "account": "d370128_0-slohmaier"})
|
||||
{"query": "stefan", "limit": 1, "account": "mcp-test-mail"})
|
||||
if "No results" in text:
|
||||
pytest.skip("No mails found")
|
||||
# Parse account, folder, key from result
|
||||
@@ -171,7 +171,7 @@ class TestMail:
|
||||
token = get_token(self.PORT)
|
||||
# Find a mail with an attachment by scanning Rechnung search results
|
||||
text = tool_call(self.PORT, token, "search_mail",
|
||||
{"query": "Rechnung", "limit": 10, "account": "d370128_0-slohmaier"})
|
||||
{"query": "Rechnung", "limit": 10, "account": "mcp-test-mail"})
|
||||
if "No results" in text:
|
||||
pytest.skip("No mails found")
|
||||
# Read each result, look for one with attachments
|
||||
@@ -211,7 +211,7 @@ class TestCalendar:
|
||||
|
||||
def test_list_calendars(self):
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "list_calendars")
|
||||
assert "calendar-stefan" in text or "Stefan" in text
|
||||
assert "calendar-test" in text or "MCP Test" in text
|
||||
|
||||
def test_list_task_lists(self):
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "list_task_lists")
|
||||
@@ -251,7 +251,7 @@ class TestCalendar:
|
||||
|
||||
def test_get_events_date_range(self):
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "get_events", {
|
||||
"calendar": "stefan", "date_from": "2026-06-01", "date_to": "2026-06-30",
|
||||
"calendar": "calendar-test", "date_from": "2026-06-01", "date_to": "2026-06-30",
|
||||
})
|
||||
assert "Wann:" in text or "Keine Termine" in text
|
||||
|
||||
@@ -264,8 +264,8 @@ class TestContacts:
|
||||
PORT = SERVERS["contacts"]
|
||||
|
||||
def test_search_real_contacts(self):
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "search_contacts", {"query": "Lohmaier", "limit": 3})
|
||||
assert "Lohmaier" in text
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "search_contacts", {"query": "Mustermann", "limit": 3})
|
||||
assert "Mustermann" in text
|
||||
|
||||
def test_search_empty(self):
|
||||
text = tool_call(self.PORT, get_token(self.PORT), "search_contacts", {"query": "xyzzy_nobody_99"})
|
||||
@@ -288,14 +288,14 @@ class TestContacts:
|
||||
|
||||
def test_get_contact_details(self):
|
||||
token = get_token(self.PORT)
|
||||
search = tool_call(self.PORT, token, "search_contacts", {"query": "Lohmaier", "limit": 1})
|
||||
search = tool_call(self.PORT, token, "search_contacts", {"query": "Mustermann", "limit": 1})
|
||||
if "Keine" in search:
|
||||
pytest.skip("No contacts")
|
||||
uid = [l for l in search.split("\n") if "UID:" in l][0].split("UID: ")[1].strip()
|
||||
# get_contact returns list content, first element is text
|
||||
result = mcp_call(self.PORT, token, "tools/call", {"name": "get_contact", "arguments": {"uid": uid}})
|
||||
text = result["result"]["content"][0]["text"]
|
||||
assert "Lohmaier" in text
|
||||
assert "Mustermann" in text
|
||||
assert "UID:" in text
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user