Files
stack/tests/cli/test_prisma_exercise.py
kert dbf71a6594 test: 99.93% coverage — Zotero 9 schema fix + 400+ new tests
Fix Zotero table models for Zotero 9:
- Remove stale Annotations/Highlights/Transaction* models
- Add ItemAnnotations, RetractedItems, DeletedCollections,
  DeletedSearches, DbDebug1
- Fix ItemAttachments, Libraries, Users column mismatches

New test files covering all major modules:
- cli/{bib,prisma,rec,zot,mail,run} deep exercising tests
- mail/{droplet,postmark,resend,cloudflare} lifecycle tests
- bib/{iom,oig,pincite,sync,regulations_gov,email_ingest,format,store}
- prisma/{vpn,fetch,export,llm,screen,eligibility,extract,project,ingest,flow}
- aco/lake/{unity,quality,deploy} + api/aco coverage gaps
- zot/{ops,db,extract,duck} + rec/{report,engine,base,pricers}
- pfs/{pipe,rules,eq,files}

Add pytest-xdist for parallel test execution.

Tracks #353
2026-04-18 10:06:47 -04:00

47 lines
1.3 KiB
Python

"""Exercise cli/prisma.py commands with mocked backends."""
from __future__ import annotations
from unittest.mock import MagicMock, patch
from typer.testing import CliRunner
from cli.prisma import app
runner = CliRunner()
class TestPingLlm:
@patch("prisma.llm.make_provider")
def test_ping(self, mock_mp):
provider = MagicMock()
from prisma.llm import LLMResult
provider.complete.return_value = LLMResult(
text="pong", tool_calls=[], usage={"input_tokens": 1, "output_tokens": 1}
)
mock_mp.return_value = provider
result = runner.invoke(app, ["ping-llm"])
assert result.exit_code == 0
assert "pong" in result.output
class TestVpnHelp:
def test_up(self):
assert runner.invoke(app, ["vpn", "up", "--help"]).exit_code == 0
def test_down(self):
assert runner.invoke(app, ["vpn", "down", "--help"]).exit_code == 0
def test_status(self):
assert runner.invoke(app, ["vpn", "status", "--help"]).exit_code == 0
def test_verify(self):
assert runner.invoke(app, ["vpn", "verify", "--help"]).exit_code == 0
def test_attach_zotero(self):
assert runner.invoke(app, ["vpn", "attach-zotero", "--help"]).exit_code == 0
def test_detach_zotero(self):
assert runner.invoke(app, ["vpn", "detach-zotero", "--help"]).exit_code == 0