Merge branch 'dev' into hugo-shipping-notice

This commit is contained in:
hugo committed 2026-08-11 14:33:56 +08:00
commit 472b530be3
397 files changed
+46450 -34171

No files matched your search

+19 -2
View File
@@ -3,9 +3,9 @@ tests/jobs/test_store.py
用途:验证 store.claim_next 归一化与空队列行为。
"""
from app.jobs.store import _normalize_kb_job
from app.jobs.store import _normalize_generic_job, _normalize_kb_job
from app.jobs.types import JobType
from app.models import KbJob
from app.models import Job, KbJob
def test_normalize_kb_job_clean(app):
@@ -77,3 +77,20 @@ def test_find_shipping_notice_job_id_matches_task_no(app):
db.session.commit()
assert _find_shipping_notice_job_id('ship-a') == target.id
def test_normalize_schedule_generic_job(app):
"""断言 schedule 通用 Job 会携带 job_id/run_id 交给 handler。"""
with app.app_context():
job = Job(
id=99,
domain='schedule',
job_type=JobType.SCHEDULE_RUN.value,
status='running',
attempts=1,
payload_json={'schedule_run_id': 12},
)
normalized = _normalize_generic_job(job)
assert normalized['job_type'] == JobType.SCHEDULE_RUN
assert normalized['attempts'] == 1
assert normalized['payload'] == {'job_id': 99, 'schedule_run_id': 12}