Add organizations v2 API and registry enrichment
This commit is contained in:
57
tests/apps/organizations/test_models.py
Normal file
57
tests/apps/organizations/test_models.py
Normal 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, "Общество с ограниченной ответственностью Ромашка")
|
||||
Reference in New Issue
Block a user