Add production SynthID routing and OpenAI verification

This commit is contained in:
Victor Kuznetsov
2026-08-14 13:35:22 -07:00
parent faf976d53e
commit 2d018d32ab
32 changed files with 5518 additions and 118 deletions
+76
View File
@@ -785,6 +785,82 @@ class TestDetectSynthIDCommand:
assert "Bounded spatial-scale registration was enabled" in result.output
class TestVerifyOpenAISynthIDCommand:
def test_help_names_upload_and_pixel_independence(self, runner):
result = runner.invoke(main, ["verify-openai-synthid", "--help"])
assert result.exit_code == 0
assert "--acknowledge-upload" in result.output
assert "independently of C2PA" in result.output
def test_upload_requires_explicit_acknowledgement(self, runner, tmp_clean_png, monkeypatch):
from remove_ai_watermarks import openai_provenance
called = False
def verify(_source, *, acknowledge_upload):
nonlocal called
assert acknowledge_upload is True
called = True
monkeypatch.setattr(openai_provenance, "verify_openai_synthid", verify)
result = runner.invoke(main, ["verify-openai-synthid", str(tmp_clean_png)])
assert result.exit_code != 0
assert "pass --acknowledge-upload" in result.output
assert called is False
def test_json_result_is_machine_readable(self, runner, tmp_clean_png, monkeypatch):
from remove_ai_watermarks import openai_provenance
expected = openai_provenance.OpenAISynthIDDetection(
status="not_detected",
model=None,
generated_at=None,
api_created_at=1_778_000_000,
)
monkeypatch.setattr(
openai_provenance,
"verify_openai_synthid",
lambda _source, *, acknowledge_upload: expected if acknowledge_upload else None,
)
result = runner.invoke(
main,
["verify-openai-synthid", str(tmp_clean_png), "--acknowledge-upload", "--json"],
)
assert result.exit_code == 0, result.output
payload = json.loads(result.output)
assert payload == expected.to_dict()
assert "c2pa" not in payload
def test_text_result_preserves_negative_scope(self, runner, tmp_clean_png, monkeypatch):
from remove_ai_watermarks import openai_provenance
expected = openai_provenance.OpenAISynthIDDetection(
status="not_detected",
model=None,
generated_at=None,
api_created_at=None,
)
monkeypatch.setattr(
openai_provenance,
"verify_openai_synthid",
lambda _source, *, acknowledge_upload: expected if acknowledge_upload else None,
)
result = runner.invoke(
main,
["verify-openai-synthid", str(tmp_clean_png), "--acknowledge-upload"],
)
assert result.exit_code == 0, result.output
assert "AI provenance metadata was stripped" in result.output
assert "not proof" in result.output
class TestBatchCommand:
"""Tests for the 'batch' subcommand."""