fix: resolve parser organizations from directory only
Some checks failed
CI/CD Pipeline / Quality Gate (push) Failing after 32s
CI/CD Pipeline / Build and Push Images (push) Has been skipped
CI/CD Pipeline / Internal Notify (push) Successful in 0s
CI/CD Pipeline / Deploy Dev via Compose (push) Has been skipped

This commit is contained in:
2026-06-07 16:28:57 +02:00
parent 6ba8fa8d88
commit 802257a757
19 changed files with 184 additions and 83 deletions

View File

@@ -6,6 +6,7 @@ from apps.parsers.models import ParserLoadLog
from django.apps import apps as django_apps
from django.core.cache import cache
from django.test import TestCase
from django.utils import timezone
from django_celery_beat.models import PeriodicTask
from organizations.cache import get_organization_api_cache_version
from organizations.models import (
@@ -24,8 +25,13 @@ from tests.apps.parsers.factories import IndustrialCertificateRecordFactory
class OrganizationSourceBackfillTasksTest(TestCase):
"""Checks Celery tasks that maintain API v2 organization source extensions."""
@staticmethod
def _directory_organization(**kwargs) -> Organization:
kwargs.setdefault("directory_imported_at", timezone.now())
return Organization.objects.create(**kwargs)
def test_backfill_all_task_rebuilds_sources_and_invalidates_api_cache(self):
organization = Organization.objects.create(
organization = self._directory_organization(
name='ООО "Источник"',
inn="7800000401",
ogrn="1027700144401",
@@ -57,7 +63,7 @@ class OrganizationSourceBackfillTasksTest(TestCase):
)
def test_backfill_parser_batch_task_limits_source_and_batch(self):
organization = Organization.objects.create(
organization = self._directory_organization(
name='ООО "Пакет источника"',
inn="7800000402",
ogrn="1027700144402",