fix: accept nullable message publishers and scoped dev SPB trust
Some checks failed
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m3s
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-05 19:23:03 +02:00
parent 0dd763109b
commit 1a82345ab3
13 changed files with 131 additions and 15 deletions

View File

@@ -151,6 +151,27 @@ class CheckoSectionContractTests(TestCase):
== "partial"
)
def test_nullable_publisher_survives_public_list_and_detail(self):
first = fixture("messages-page-1.json")
first["data"]["Записи"][0]["Публикатор"] = None
with patch.object(
snapshots,
"_client",
return_value=client_with(first, fixture("messages-page-2.json")),
):
snapshots.refresh_checko_section(source="checko_messages", load_batch=1)
response = self.client.get(self.url, {"source_group": "company_messages"})
assert response.status_code == 200, response.data
row = next(
row
for row in response.data["data"]
if row["payload"]["publisher_identifier"] is None
)
detail = self.client.get(self.url + row["uid"] + "/")
assert detail.status_code == 200, detail.data
assert detail.data["payload"] == row["payload"]
assert row["payload"]["participant_identifiers"] == [self.org.inn]
def test_no_completed_failure_exposes_rejected_counters(self):
source = "checko_messages"
claim_monthly_collection(organization_id=str(self.org.uid), source=source)

View File

@@ -141,12 +141,12 @@ def _canonical_records():
)
sections = []
for source in ("checko_leasing", "checko_messages", "checko_licenses"):
message_page = fixture("messages-page-1.json")
message_page["data"]["Записи"][0]["Публикатор"] = None
client = (
client_with(fixture("license.json"))
if source == "checko_licenses"
else client_with(
fixture("messages-page-1.json"), fixture("messages-page-2.json")
)
else client_with(message_page, fixture("messages-page-2.json"))
)
row = next(collect_checko_section(client, organization=fssp_org, source=source))
row.payload["upstream"]["future_nested"] = {