Files
mostovik-backend/tests/apps/organizations/test_populate_command.py
Aleksandr Meshchriakov 6ba8fa8d88
Some checks failed
CI/CD Pipeline / Quality Gate (push) Failing after 9s
CI/CD Pipeline / Build and Push Images (push) Has been skipped
CI/CD Pipeline / Deploy Dev via Compose (push) Has been skipped
CI/CD Pipeline / Internal Notify (push) Successful in 0s
feat: use authoritative organization directory
2026-06-07 16:04:43 +02:00

46 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Tests for deprecated populate_organizations command."""
from apps.parsers.models import GenericParserRecord
from django.core.management import call_command
from django.test import TestCase
from organizations.models import Organization
class PopulateOrganizationsCommandTest(TestCase):
"""Checks parser-derived organization population is disabled."""
def test_command_does_not_create_organizations_from_parser_records(self):
GenericParserRecord.objects.create(
load_batch=1,
source="arbitration",
external_id="name-only-1",
organisation_name='ООО "Ромашка"',
inn="7707083893",
ogrn="1027700132195",
)
call_command("populate_organizations", silent=True, verbosity=0)
self.assertEqual(Organization.objects.count(), 0)
def test_command_does_not_update_existing_organization_identity(self):
organization = Organization.objects.create(
name='ООО "Источник"',
inn="7707083893",
ogrn="1027700132195",
)
GenericParserRecord.objects.create(
load_batch=1,
source="trudvsem",
external_id="branch-with-kpp",
organisation_name='ООО "Источник"',
inn="7707083893",
ogrn="1027700132195",
payload={"company": {"kpp": "770701001"}},
)
call_command("populate_organizations", silent=True, verbosity=0)
organization.refresh_from_db()
self.assertEqual(organization.kpp, "")