feat: use authoritative organization directory
This commit is contained in:
@@ -6,6 +6,7 @@ from unittest.mock import patch
|
||||
from apps.core.models import BackgroundJob, JobStatus
|
||||
from apps.parsers.models import FinancialReport, FinancialReportLine, ParserLoadLog
|
||||
from django.urls import reverse
|
||||
from organizations.models import Organization
|
||||
from organizations.source_backfill import OrganizationSourceBackfillService
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APITestCase
|
||||
@@ -33,9 +34,20 @@ class SourcesApiE2ETest(APITestCase):
|
||||
|
||||
def test_source_cards_and_statuses_flow(self):
|
||||
shared_inn = _digits(10)
|
||||
shared_ogrn = _digits(13)
|
||||
report_ogrn = _digits(13)
|
||||
Organization.objects.create(
|
||||
name="Shared Organization",
|
||||
inn=shared_inn,
|
||||
ogrn=shared_ogrn,
|
||||
)
|
||||
Organization.objects.create(
|
||||
name="Financial Organization",
|
||||
ogrn=report_ogrn,
|
||||
)
|
||||
report = FinancialReport.objects.create(
|
||||
external_id=_digits(5),
|
||||
ogrn=_digits(13),
|
||||
ogrn=report_ogrn,
|
||||
file_name=f"fin_{_digits(5)}_{_digits(13)}.xlsx",
|
||||
file_hash=fake.sha256(raw_output=False),
|
||||
load_batch=1,
|
||||
@@ -51,11 +63,11 @@ class SourcesApiE2ETest(APITestCase):
|
||||
period_start=100,
|
||||
period_end=200,
|
||||
)
|
||||
IndustrialCertificateRecordFactory(inn=shared_inn)
|
||||
IndustrialProductRecordFactory(inn=shared_inn)
|
||||
ManufacturerRecordFactory(inn=shared_inn)
|
||||
IndustrialCertificateRecordFactory(inn=shared_inn, ogrn=shared_ogrn)
|
||||
IndustrialProductRecordFactory(inn=shared_inn, ogrn=shared_ogrn)
|
||||
ManufacturerRecordFactory(inn=shared_inn, ogrn=shared_ogrn)
|
||||
InspectionRecordFactory()
|
||||
ProcurementRecordFactory(customer_inn=shared_inn)
|
||||
ProcurementRecordFactory(customer_inn=shared_inn, customer_ogrn=shared_ogrn)
|
||||
ParserLoadLogFactory(
|
||||
source=ParserLoadLog.Source.FNS_REPORTS,
|
||||
status="success",
|
||||
|
||||
Reference in New Issue
Block a user