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
93 lines
2.9 KiB
Python
93 lines
2.9 KiB
Python
"""Deep exercising tests for cli/bib.py."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from unittest.mock import MagicMock, patch
|
|
|
|
from typer.testing import CliRunner
|
|
|
|
from cli.bib import app
|
|
|
|
runner = CliRunner()
|
|
|
|
|
|
class TestSync:
|
|
@patch("bib.meta.apply_column_comments", return_value=["s1"])
|
|
@patch("bib.meta.collect_column_comments", return_value={"r": "d"})
|
|
@patch("bib.connect", return_value=MagicMock())
|
|
@patch("conf.path", return_value="/tmp/test.duckdb")
|
|
@patch("duckdb.connect")
|
|
def test_sync(self, mc_duck, mc_path, mc_connect, mc_cc, mc_ac):
|
|
result = runner.invoke(app, ["sync"])
|
|
assert result.exit_code == 0
|
|
|
|
@patch("bib.meta.collect_column_comments", return_value={"r": "d"})
|
|
@patch("bib.connect", return_value=MagicMock())
|
|
def test_sync_dry(self, mc_connect, mc_cc):
|
|
result = runner.invoke(app, ["sync", "--dry-run"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestTag:
|
|
@patch("bib.connect")
|
|
def test_tag(self, mc):
|
|
store = MagicMock()
|
|
store.list_tags.return_value = [{"name": "t1", "count": 5}]
|
|
mc.return_value = store
|
|
result = runner.invoke(app, ["tag"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestQuery:
|
|
@patch("bib.connect")
|
|
def test_query(self, mc):
|
|
store = MagicMock()
|
|
store.list_items.return_value = []
|
|
mc.return_value = store
|
|
result = runner.invoke(app, ["query", "test"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestDiscoverPfsRules:
|
|
@patch("bib.federalregister.pfs_rules", return_value=[])
|
|
def test_dry_run(self, mc):
|
|
result = runner.invoke(app, ["discover-pfs-rules", "--dry-run"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestAllHelp:
|
|
"""Exercise every registered command's --help (exercises Typer paths)."""
|
|
|
|
def test_fetch_docket(self):
|
|
assert runner.invoke(app, ["fetch-docket-comments", "--help"]).exit_code == 0
|
|
|
|
def test_fetch_pfs(self):
|
|
assert runner.invoke(app, ["fetch-pfs-comments", "--help"]).exit_code == 0
|
|
|
|
def test_ingest_iom(self):
|
|
assert runner.invoke(app, ["ingest-iom", "--help"]).exit_code == 0
|
|
|
|
def test_attach_iom(self):
|
|
assert runner.invoke(app, ["attach-iom", "--help"]).exit_code == 0
|
|
|
|
def test_ingest_oig(self):
|
|
assert runner.invoke(app, ["ingest-oig", "--help"]).exit_code == 0
|
|
|
|
def test_attach_oig(self):
|
|
assert runner.invoke(app, ["attach-oig", "--help"]).exit_code == 0
|
|
|
|
def test_sync_zotero(self):
|
|
assert runner.invoke(app, ["sync-zotero", "--help"]).exit_code == 0
|
|
|
|
def test_backfill(self):
|
|
assert runner.invoke(app, ["backfill-comments", "--help"]).exit_code == 0
|
|
|
|
def test_ingest_mail(self):
|
|
assert runner.invoke(app, ["ingest-mail", "--help"]).exit_code == 0
|
|
|
|
def test_refresh_iom(self):
|
|
assert runner.invoke(app, ["refresh-iom", "--help"]).exit_code == 0
|
|
|
|
def test_refresh_oig(self):
|
|
assert runner.invoke(app, ["refresh-oig", "--help"]).exit_code == 0
|