fix: implement backend testing amendments and atomic source publication
Some checks failed
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m16s
Mostovik Backend CI/CD / Deploy dev (push) Has been cancelled
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been cancelled
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Has been cancelled

This commit is contained in:
Aleksandr Meshchryakov
2026-10-12 09:47:28 +02:00
parent 2eeb237a47
commit 9b3da5b505
46 changed files with 2918 additions and 335 deletions

View File

@@ -9,6 +9,7 @@ from unittest.mock import patch
from uuid import uuid4
import pytest
from apps.core.models import BackgroundJob
from apps.parsers.budget_registry import normalize_budget_record
from apps.parsers.checko_sections import collect_checko_section
from apps.parsers.fssp_csv import FSSP_SOURCE, GENERAL_DATASET, iter_fssp_records
@@ -333,6 +334,31 @@ def test_source_record_runtime_fixtures():
404,
)
options_url = list_url + "filter-options/"
capture(
"message-type-options",
"options",
client.get(options_url, {"source_group": "leasing", "field": "message_type"}),
200,
)
capture(
"message-type-options-invalid",
"options",
client.get(options_url, {"source_group": "unknown", "field": "message_type"}),
400,
)
user = UserFactory.create_superuser()
client.force_authenticate(user)
for state in ("failed", "success", "skipped"):
job = BackgroundJob.objects.create(
task_id=f"contract-{state}", task_name="test", user_id=user.id
)
if state == "failed":
job.fail("HTTPError: https://user:secret@example.test/?token=secret")
else:
job.complete(result={"status": state})
capture(f"job-{state}", "job", client.get(f"/api/v1/jobs/{job.task_id}/"), 200)
# Ordinary pytest runs create no artifact. CI opts in with an explicit path.
destination = os.environ.get("OPENAPI_RUNTIME_FIXTURES")
if destination: