Add organizations v2 API and registry enrichment
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 26s
CI/CD Pipeline / Build and Push Images (push) Successful in 6s
CI/CD Pipeline / Internal Notify (push) Successful in 0s
CI/CD Pipeline / Deploy Dev in Dokploy (push) Successful in 1s

This commit is contained in:
2026-05-06 19:04:46 +02:00
parent f54aa4cb0b
commit 0f17ff6773
62 changed files with 10311 additions and 430 deletions

View File

@@ -14,6 +14,7 @@ from apps.parsers.clients.minpromtorg.schemas import (
from apps.parsers.clients.proverki.schemas import Inspection
from apps.parsers.clients.zakupki.schemas import Procurement
from apps.parsers.models import (
GenericParserRecord,
IndustrialCertificateRecord,
IndustrialProductRecord,
InspectionRecord,
@@ -23,6 +24,7 @@ from apps.parsers.models import (
Proxy,
)
from apps.parsers.services import (
GenericParserRecordService,
IndustrialCertificateService,
IndustrialProductService,
InspectionService,
@@ -214,6 +216,32 @@ class ProxyServiceTest(TestCase):
self.assertEqual(result, [manual_ru.address])
class GenericParserRecordServiceTest(TestCase):
def test_conflict_retry_does_not_use_per_row_get_or_create(self):
GenericParserRecord.objects.create(
load_batch=1,
source=ParserLoadLog.Source.CONTRACTS,
external_id="existing",
)
instance = GenericParserRecord(
load_batch=2,
source=ParserLoadLog.Source.CONTRACTS,
external_id="existing",
)
with patch(
"django.db.models.query.QuerySet.get_or_create",
side_effect=AssertionError("per-row get_or_create must not be used"),
):
created = GenericParserRecordService._create_with_exact_count(
[instance],
unique_fields=["source", "external_id"],
chunk_size=500,
)
self.assertEqual(created, 0)
class ProxyToolsSyncServiceTest(TestCase):
"""Tests for ProxyToolsSyncService."""