test: 修复报工提交归属测试时间窗口

This commit is contained in:
souplearn 2026-07-25 22:23:44 +08:00
parent 00dd4f93b5
commit 655e492a13

View File

@ -35,6 +35,7 @@ from app.schemas import (
ReportSubmitRequest, ReportSubmitRequest,
) )
from app.services import auto_submit as auto_submit_service from app.services import auto_submit as auto_submit_service
from app.services import reporting_window as reporting_window_service
from app.services.report_lifecycle import purge_expired_voided_reports from app.services.report_lifecycle import purge_expired_voided_reports
from app.services.metrics import calculate_report_metrics from app.services.metrics import calculate_report_metrics
from app.services.report_allocations import ( from app.services.report_allocations import (
@ -896,6 +897,7 @@ def test_submit_report_creates_allocations(monkeypatch):
db.add_all([session, _press_equipment(), _product()]) db.add_all([session, _press_equipment(), _product()])
db.commit() db.commit()
monkeypatch.setattr(reports_router, "report_out", lambda report, schedule=None: report) monkeypatch.setattr(reports_router, "report_out", lambda report, schedule=None: report)
monkeypatch.setattr(reporting_window_service, "now", lambda: datetime(2026, 7, 25, 11, 5))
report = reports_router.submit_report( report = reports_router.submit_report(
ReportSubmitRequest( ReportSubmitRequest(