test: umfangreiche Testdaten (alle Dateitypen + Mail-Anhaenge)
- oCIS /testdata/: Bilder (jpg/png/webp/bmp/gif/tiff/svg), Audio (mp3/ogg/m4a/ flac/wav), Video (mp4), PDFs (Text + Scan), Office (docx/xlsx/pptx), Text/Daten (md/txt/csv/json/xml/yaml/html/py/vcf/ics), Archive (zip/tar.gz). - Maildir: Mails mit diversen Anhaengen (PDF/Bild/Word/Excel/MP3/MP4/PPTX/ZIP). - TestFileTypes: read_file je Typ -> Content-Typ pruefen (image/text/resource). - Generatoren tests/testdata/gen_testfiles.py + gen_maildir.py + upload_ocis.sh. 68 Tests gruen (vorher 54). Doku in MCPTEST.md.
This commit is contained in:
@@ -421,3 +421,37 @@ class TestNotes:
|
||||
# Verify it appears in the notebook listing
|
||||
listing = tool_call(self.PORT, token, "list_notes", {"notebook": self.TEST_NOTEBOOK})
|
||||
assert note_id in listing or f"Test Note {tag}" in listing
|
||||
|
||||
|
||||
# ============================================================
|
||||
# File Type Tests (read_file auf vorbereiteten /testdata-Dateien)
|
||||
# ============================================================
|
||||
|
||||
class TestFileTypes:
|
||||
"""Liest die mcptest-Testdaten verschiedener Typen und prueft den Content-Typ."""
|
||||
PORT = SERVERS["files"]
|
||||
|
||||
CASES = [
|
||||
("testdata/images/photo.jpg", {"image"}),
|
||||
("testdata/images/screenshot.png", {"image"}),
|
||||
("testdata/images/logo.svg", {"image"}),
|
||||
("testdata/text/notes.txt", {"text"}),
|
||||
("testdata/text/readme.md", {"text"}),
|
||||
("testdata/text/data.csv", {"text"}),
|
||||
("testdata/documents/document.pdf", {"text"}), # Text-PDF -> extrahiert
|
||||
("testdata/documents/scanned.pdf", {"text", "resource"}),# Scan-PDF
|
||||
("testdata/documents/report.docx", {"text"}),
|
||||
("testdata/documents/budget.xlsx", {"text"}),
|
||||
("testdata/documents/slides.pptx", {"text"}),
|
||||
("testdata/audio/tone.mp3", {"resource"}),
|
||||
("testdata/video/clip.mp4", {"resource"}),
|
||||
("testdata/archives/archive.zip", {"resource"}),
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("path,expected", CASES)
|
||||
def test_read_file_type(self, path, expected):
|
||||
token = get_token(self.PORT)
|
||||
result = mcp_call(self.PORT, token, "tools/call",
|
||||
{"name": "read_file", "arguments": {"path": path}})
|
||||
types = {c["type"] for c in result["result"]["content"]}
|
||||
assert types & expected, f"{path}: erwartet eins von {expected}, bekam {types}"
|
||||
|
||||
Reference in New Issue
Block a user