Add organizations v2 API and registry enrichment
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 26s
CI/CD Pipeline / Build and Push Images (push) Successful in 6s
CI/CD Pipeline / Internal Notify (push) Successful in 0s
CI/CD Pipeline / Deploy Dev in Dokploy (push) Successful in 1s

This commit is contained in:
2026-05-06 19:04:46 +02:00
parent f54aa4cb0b
commit 0f17ff6773
62 changed files with 10311 additions and 430 deletions

View File

@@ -0,0 +1,57 @@
"""Tests for organizations models."""
from django.test import TestCase
from organizations.models import Organization
class OrganizationModelTest(TestCase):
"""Checks canonical organization model constraints and rendering."""
def test_legal_entity_can_store_kpp_and_ogrn_without_ogrip(self):
organization = Organization.objects.create(
name='ООО "Ромашка"',
inn="7707083893",
kpp="770701001",
ogrn="1027700132195",
)
self.assertIsNotNone(organization.uid)
self.assertEqual(organization.ogrip, "")
self.assertEqual(str(organization), 'ООО "Ромашка" (7707083893)')
def test_individual_entrepreneur_can_store_ogrip_without_kpp_and_ogrn(self):
organization = Organization.objects.create(
name="ИП Иванов Иван Иванович",
inn="500100732259",
ogrip="304500116000157",
)
self.assertEqual(organization.kpp, "")
self.assertEqual(organization.ogrn, "")
self.assertEqual(organization.ogrip, "304500116000157")
def test_legal_entities_can_share_inn_with_different_kpp(self):
Organization.objects.create(
name='ООО "Ромашка" головной офис',
inn="7707083893",
kpp="770701001",
ogrn="1027700132195",
)
branch = Organization.objects.create(
name='ООО "Ромашка" филиал',
inn="7707083893",
kpp="780101001",
ogrn="1027700132195",
)
self.assertEqual(branch.inn, "7707083893")
self.assertEqual(branch.kpp, "780101001")
def test_name_only_organization_is_allowed(self):
organization = Organization.objects.create(
name="Общество с ограниченной ответственностью Ромашка",
)
self.assertEqual(organization.inn, "")
self.assertEqual(organization.name, "Общество с ограниченной ответственностью Ромашка")