fix: preserve long prosecutor authority names
All checks were successful
CI/CD Pipeline / Code Quality Checks (push) Successful in 2m4s
CI/CD Pipeline / Run Tests (push) Successful in 3m44s
CI/CD Pipeline / Build and Push Dev Images (push) Successful in 37s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 33s

This commit is contained in:
2026-08-09 12:49:41 +02:00
parent 079d7a8549
commit ea9704f215
3 changed files with 36 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("external_data", "0009_arbitration_case_claim_amount"),
]
operations = [
migrations.AlterField(
model_name="prosecutorcheck",
name="control_authority",
field=models.TextField(verbose_name="контрольный орган"),
),
]

View File

@@ -101,7 +101,7 @@ class ProsecutorCheck(UUIDPrimaryKeyMixin, TimestampMixin, models.Model):
_("регистрационный номер"), max_length=64, db_index=True
)
law_type = models.CharField(_("тип закона"), max_length=32, db_index=True)
control_authority = models.CharField(_("контрольный орган"), max_length=255)
control_authority = models.TextField(_("контрольный орган"))
prosecutor_office = models.CharField(
_("прокуратура"), max_length=255, blank=True, default=""
)

View File

@@ -489,6 +489,7 @@ class ExchangePackageApiTest(APITestCase):
response.data["result"]["financial_reports"]["created_lines"],
1,
)
self.assertEqual(
response.data["result"]["defense_unreliable_suppliers"]["created"],
1,
@@ -535,6 +536,25 @@ class ExchangePackageApiTest(APITestCase):
self.assertEqual(package_import.delivery_channel, ExchangeDeliveryChannel.API)
self.assertEqual(package_import.status, "success")
def test_upload_preserves_long_prosecutor_control_authority(self):
payload = build_exchange_payload()
long_authority = "Межрегиональное контрольное управление " + "А" * 300
payload["prosecutor_checks"][0]["control_authority"] = long_authority
archive = build_exchange_archive(data=payload)
response = self.client.post(
self.url,
{"file": archive},
format="multipart",
HTTP_X_EXCHANGE_TOKEN=TEST_TOKEN,
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(
ProsecutorCheck.objects.get().control_authority,
long_authority,
)
def test_upload_rejects_invalid_exchange_token(self):
archive = build_exchange_archive(data=build_exchange_payload())
invalid_token = get_random_string(24)