fix: resolve parser organizations from directory only
This commit is contained in:
@@ -20,6 +20,10 @@ from rest_framework import status
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from tests.apps.parsers.factories import ParserLoadLogFactory
|
||||
from tests.apps.parsers.organization_helpers import (
|
||||
create_directory_organization,
|
||||
get_or_create_directory_organization,
|
||||
)
|
||||
from tests.apps.user.factories import UserFactory
|
||||
from tests.utils.fixtures import fake
|
||||
|
||||
@@ -45,7 +49,7 @@ def _save_source_record(
|
||||
if ogrn:
|
||||
query["ogrn"] = ogrn
|
||||
if not Organization.objects.filter(**query).exists():
|
||||
Organization.objects.create(
|
||||
create_directory_organization(
|
||||
name=organization_name or title or external_id,
|
||||
inn=inn,
|
||||
ogrn=ogrn,
|
||||
@@ -54,7 +58,7 @@ def _save_source_record(
|
||||
rn_key = organization_name or title or external_id
|
||||
rn = str(int(hashlib.sha256(rn_key.encode()).hexdigest()[:12], 16) % 10**12)
|
||||
payload["rn"] = rn
|
||||
Organization.objects.get_or_create(
|
||||
get_or_create_directory_organization(
|
||||
rn=rn,
|
||||
defaults={"name": organization_name or title or external_id},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user