refactor(api): admit download job create and retry through one job_admission step

This commit is contained in:
imSp4rky
2026-11-25 23:15:16 -07:00
parent 92e8abbdbc
commit ee8e968127
27 changed files with 584 additions and 417 deletions
+17
View File
@@ -0,0 +1,17 @@
"""Test helper for the parameter check of download job admission."""
from typing import Any
from unshackle.core.api.errors import APIError
from unshackle.core.api.job_admission import check_parameters, check_plan
from unshackle.core.remote_protocol import APIErrorCode
def refusal(data: dict[str, Any]) -> str | None:
"""The message of the INVALID_PARAMETERS refusal that the parameter and plan checks give ``data``, else None."""
try:
check_plan(check_parameters(data))
except APIError as e:
assert e.error_code is APIErrorCode.INVALID_PARAMETERS
return e.message
return None