feat: import mostovik exchange sections
All checks were successful
CI/CD Pipeline / Run Tests (push) Successful in 6m12s
CI/CD Pipeline / Code Quality Checks (push) Successful in 6m19s
CI/CD Pipeline / Build Docker Images (push) Successful in 2m21s
CI/CD Pipeline / Push to Gitea Registry (push) Successful in 1s
CI/CD Pipeline / Deploy to Server (push) Successful in 1s

This commit is contained in:
2026-05-27 23:13:40 +02:00
parent bd8e1a8400
commit d1b0cd7945
49 changed files with 1831 additions and 319 deletions

View File

@@ -1,6 +1,7 @@
"""Tests for Organization services."""
from apps.organization.services import OrganizationService
from apps.organization.models import Organization
from apps.organization.services import OrganizationNotFoundError, OrganizationService
from django.test import TestCase
from .factories import OrganizationFactory
@@ -9,15 +10,15 @@ from .factories import OrganizationFactory
class OrganizationServiceTest(TestCase):
"""Tests for OrganizationService."""
def test_get_or_create_by_inn_creates_new(self):
"""Test get_or_create_by_inn creates new organization."""
org, created = OrganizationService.get_or_create_by_inn(
inn="1234567890",
defaults={"name": "Test Org", "ogrn": "1234567890123"},
)
self.assertTrue(created)
self.assertEqual(org.inn, "1234567890")
self.assertEqual(org.name, "Test Org")
def test_get_or_create_by_inn_rejects_missing_organization(self):
"""OrganizationService must not create organizations outside exchange import."""
with self.assertRaises(OrganizationNotFoundError):
OrganizationService.get_or_create_by_inn(
inn="1234567890",
defaults={"name": "Test Org", "ogrn": "1234567890123"},
)
self.assertEqual(Organization.objects.count(), 0)
def test_get_or_create_by_inn_returns_existing(self):
"""Test get_or_create_by_inn returns existing organization."""