fix: preserve long prosecutor authority names
All checks were successful
All checks were successful
This commit is contained in:
@@ -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="контрольный орган"),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -101,7 +101,7 @@ class ProsecutorCheck(UUIDPrimaryKeyMixin, TimestampMixin, models.Model):
|
|||||||
_("регистрационный номер"), max_length=64, db_index=True
|
_("регистрационный номер"), max_length=64, db_index=True
|
||||||
)
|
)
|
||||||
law_type = models.CharField(_("тип закона"), max_length=32, 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(
|
prosecutor_office = models.CharField(
|
||||||
_("прокуратура"), max_length=255, blank=True, default=""
|
_("прокуратура"), max_length=255, blank=True, default=""
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -489,6 +489,7 @@ class ExchangePackageApiTest(APITestCase):
|
|||||||
response.data["result"]["financial_reports"]["created_lines"],
|
response.data["result"]["financial_reports"]["created_lines"],
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
response.data["result"]["defense_unreliable_suppliers"]["created"],
|
response.data["result"]["defense_unreliable_suppliers"]["created"],
|
||||||
1,
|
1,
|
||||||
@@ -535,6 +536,25 @@ class ExchangePackageApiTest(APITestCase):
|
|||||||
self.assertEqual(package_import.delivery_channel, ExchangeDeliveryChannel.API)
|
self.assertEqual(package_import.delivery_channel, ExchangeDeliveryChannel.API)
|
||||||
self.assertEqual(package_import.status, "success")
|
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):
|
def test_upload_rejects_invalid_exchange_token(self):
|
||||||
archive = build_exchange_archive(data=build_exchange_payload())
|
archive = build_exchange_archive(data=build_exchange_payload())
|
||||||
invalid_token = get_random_string(24)
|
invalid_token = get_random_string(24)
|
||||||
|
|||||||
Reference in New Issue
Block a user