fix: keep organization identity types exclusive
This commit is contained in:
@@ -154,6 +154,52 @@ class OrganizationSourceIngestionServiceTest(TestCase):
|
||||
record = OrganizationSourceRecord.objects.get(external_id="fstec-5067")
|
||||
self.assertEqual(record.extension.organization, partial)
|
||||
|
||||
def test_save_records_ignores_ogrip_like_ogrn_for_legal_entity_inn(self):
|
||||
result = OrganizationSourceIngestionService.save_records(
|
||||
source=ParserLoadLog.Source.INDUSTRIAL,
|
||||
load_batch=47,
|
||||
records=[
|
||||
SourceRecordInput(
|
||||
external_id="cert-legal-entity-bad-ogrn",
|
||||
title="cert-legal-entity-bad-ogrn",
|
||||
organization_name='ООО "Металл-Завод"',
|
||||
inn="7720525156",
|
||||
ogrn="105774446645395",
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
self.assertEqual(result.created_records, 1)
|
||||
organization = Organization.objects.get(inn="7720525156")
|
||||
self.assertEqual(organization.ogrn, "")
|
||||
self.assertEqual(organization.ogrip, "")
|
||||
|
||||
def test_save_records_does_not_add_ogrip_to_existing_legal_entity(self):
|
||||
organization = Organization.objects.create(
|
||||
name='ООО "Металл-Завод"',
|
||||
inn="7720525156",
|
||||
ogrn="1057746645395",
|
||||
)
|
||||
|
||||
result = OrganizationSourceIngestionService.save_records(
|
||||
source=ParserLoadLog.Source.INDUSTRIAL,
|
||||
load_batch=48,
|
||||
records=[
|
||||
SourceRecordInput(
|
||||
external_id="cert-legal-entity-existing-bad-ogrn",
|
||||
title="cert-legal-entity-existing-bad-ogrn",
|
||||
organization_name='ООО "Металл-Завод"',
|
||||
inn="7720525156",
|
||||
ogrn="105774446645395",
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
self.assertEqual(result.created_records, 1)
|
||||
organization.refresh_from_db()
|
||||
self.assertEqual(organization.ogrn, "1057746645395")
|
||||
self.assertEqual(organization.ogrip, "")
|
||||
|
||||
def test_save_financial_report_writes_financial_lines_without_legacy_report(self):
|
||||
result = OrganizationSourceIngestionService.save_records(
|
||||
source=ParserLoadLog.Source.FNS_REPORTS,
|
||||
|
||||
Reference in New Issue
Block a user