Some checks failed
CI / lint-test (push) Failing after 26s
CI / skinny-install (api) (push) Successful in 44s
CI / skinny-install (aco) (push) Successful in 1m17s
CI / skinny-install (bcda) (push) Successful in 47s
CI / skinny-install (bib) (push) Successful in 47s
CI / skinny-install (bls) (push) Successful in 32s
CI / skinny-install (ccw) (push) Successful in 29s
CI / skinny-install (cms) (push) Successful in 37s
CI / skinny-install (cli) (push) Successful in 46s
CI / skinny-install (opps) (push) Successful in 29s
CI / skinny-install (conf) (push) Successful in 43s
CI / skinny-install (perf) (push) Successful in 43s
CI / skinny-install (pfs) (push) Successful in 41s
CI / skinny-install (rex) (push) Successful in 38s
Deploy / build-scan-report (push) Failing after 5m12s
Package Supply Chain / pkg-supply-chain (push) Failing after 42s
308 new lines covered this batch (2,605→2,297 missed). Import + smoke tests replaced with exercising tests for iom, oig, sync, flow, llm, droplet, cloudflare, postmark, resend, export, project, ingest, plus CLI --help coverage for all bib/prisma/zot/rec commands. Remaining gap to 99%: 1,816 lines across cli/, mail/droplet, prisma/vpn, bib/regulations_gov, prisma/fetch. All require mocked CliRunner or httpx/pydo/subprocess exercising tests. Work continues — this commit preserves progress.
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
"""Deep tests for prisma.export."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from unittest.mock import MagicMock
|
|
|
|
from prisma.export import load_item, to_markdown
|
|
|
|
|
|
class TestLoadItem:
|
|
def test_loads_from_db(self):
|
|
db = MagicMock()
|
|
db.con.execute.return_value.fetchone.return_value = (
|
|
1,
|
|
22,
|
|
"2023-01-01",
|
|
"2023-01-01",
|
|
"2023-01-01",
|
|
1,
|
|
"TESTKEY1",
|
|
0,
|
|
0,
|
|
)
|
|
db.get_fields.return_value = {"title": "Test Paper", "DOI": "10.1234/test"}
|
|
db.get_tags.return_value = ["module:test"]
|
|
snap = load_item(db, 1, None)
|
|
# Should return some snapshot object
|
|
assert snap is not None
|
|
|
|
|
|
class TestToMarkdown:
|
|
def test_basic(self):
|
|
snap = MagicMock()
|
|
snap.title = "Test Paper"
|
|
snap.fields = {"DOI": "10.1234/test"}
|
|
snap.tags = ["module:test"]
|
|
snap.abstract = "This is the abstract."
|
|
snap.notes = []
|
|
snap.fulltext = None
|
|
md = to_markdown(snap)
|
|
assert isinstance(md, str)
|