mirror of
https://github.com/Sea-Haven-Industries/procurement-ingest.git
synced 2026-10-07 16:08:54 +00:00
Cover the deterministic parser with golden-file tests over 55 real scrubbed .eml fixtures (both comment sub-shapes, username Submitted-By, address present/absent, br+CRLF assign addresses), fail-closed validation-gate rules, adversarial and prompt-injection cases that must route to ai_fallback or parse without corrupting other fields, the issue #23 comment_id idempotency invariants, and the Bedrock-fallback dispatch plus EMF-metric emission with a mocked invoke_model. Extend pytest.ini testpaths to discover the co-located suite, and update tests/conftest.load_handler to put a handler's own directory on sys.path so the WO handler's new `from template_parser import ...` resolves under the existing shared handler tests. Point test_local.py at the new template-first + Bedrock flow. Refs: #23
19 lines
526 B
Python
19 lines
526 B
Python
"""Pytest fixtures for the work-order email-processor suite.
|
|
|
|
Path/env setup and the reusable helpers live in ``_wo_parser_support`` (a
|
|
uniquely named module) so the test files never do ``from conftest import``,
|
|
which would be ambiguous against the repo's top-level ``tests/conftest.py``.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from _wo_parser_support import FakeDynamoResource
|
|
|
|
|
|
@pytest.fixture
|
|
def fake_dynamo(monkeypatch):
|
|
import handler
|
|
|
|
fake = FakeDynamoResource()
|
|
monkeypatch.setattr(handler, "dynamodb", fake)
|
|
return fake
|