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
109 lines
2.8 KiB
Python
109 lines
2.8 KiB
Python
"""Deep exercising tests for cli/mail.py."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from unittest.mock import patch
|
|
|
|
from typer.testing import CliRunner
|
|
|
|
from cli.mail import app
|
|
|
|
runner = CliRunner()
|
|
|
|
|
|
class TestProvision:
|
|
@patch("mail.droplet.provision")
|
|
def test_basic(self, mc):
|
|
result = runner.invoke(app, ["provision"])
|
|
assert result.exit_code == 0
|
|
mc.assert_called_once()
|
|
|
|
|
|
class TestUp:
|
|
@patch("mail.droplet.up")
|
|
def test_basic(self, mc):
|
|
result = runner.invoke(app, ["up"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestDown:
|
|
@patch("mail.droplet.down")
|
|
def test_with_yes(self, mc):
|
|
result = runner.invoke(app, ["down", "--yes"])
|
|
assert result.exit_code == 0
|
|
mc.assert_called_once()
|
|
|
|
|
|
class TestStatus:
|
|
@patch(
|
|
"mail.droplet.status",
|
|
return_value={
|
|
"name": "mail.fhirworx.io",
|
|
"id": 1,
|
|
"region": "nyc3",
|
|
"public_ip": "1.2.3.4",
|
|
"status": "active",
|
|
"ptr": "mail.fhirworx.io",
|
|
"ptr_match": True,
|
|
},
|
|
)
|
|
def test_up(self, mc):
|
|
result = runner.invoke(app, ["status"])
|
|
assert result.exit_code == 0
|
|
assert "1.2.3.4" in result.output
|
|
|
|
@patch("mail.droplet.status", return_value=None)
|
|
def test_down(self, mc):
|
|
result = runner.invoke(app, ["status"])
|
|
assert result.exit_code == 0
|
|
assert "no mail droplet" in result.output
|
|
|
|
|
|
class TestDns:
|
|
@patch("mail.droplet.apply_dns")
|
|
def test_basic(self, mc):
|
|
result = runner.invoke(app, ["dns"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestDkimExport:
|
|
@patch("mail.droplet.export_dkim")
|
|
def test_basic(self, mc):
|
|
result = runner.invoke(app, ["dkim-export"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestAttachSmarthost:
|
|
@patch("mail.droplet.attach_smarthost")
|
|
def test_basic(self, mc):
|
|
result = runner.invoke(app, ["attach-smarthost"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestRotateCreds:
|
|
@patch("mail.droplet.rotate_creds")
|
|
def test_basic(self, mc):
|
|
result = runner.invoke(app, ["rotate-creds", "git"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestSeedMailboxes:
|
|
@patch("mail.droplet.seed_mailboxes")
|
|
def test_basic(self, mc):
|
|
result = runner.invoke(app, ["seed-mailboxes"])
|
|
assert result.exit_code == 0
|
|
|
|
|
|
class TestWireGit:
|
|
@patch("mail.droplet.write_git_mailer_env", return_value=True)
|
|
def test_changed(self, mc):
|
|
result = runner.invoke(app, ["wire-git"])
|
|
assert result.exit_code == 0
|
|
assert "written" in result.output
|
|
|
|
@patch("mail.droplet.write_git_mailer_env", return_value=False)
|
|
def test_unchanged(self, mc):
|
|
result = runner.invoke(app, ["wire-git"])
|
|
assert result.exit_code == 0
|
|
assert "unchanged" in result.output
|