feat(external-data): add information security registry entries endpoint

This commit is contained in:
2026-04-14 11:00:24 +02:00
parent f0c4f501a6
commit 148c4862d7
9 changed files with 168 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ from apps.external_data.models import (
IndustrialProduct,
ProsecutorCheck,
PublicProcurement,
InformationSecurityRegistryEntry,
)
from faker import Faker
@@ -68,3 +69,17 @@ class ArbitrationCaseFactory(factory.django.DjangoModelFactory):
party_role = "defendant"
status = "hearing_scheduled"
decision_date = factory.LazyAttribute(lambda _: fake.date_this_year())
class InformationSecurityRegistryEntryFactory(
factory.django.DjangoModelFactory
):
class Meta:
model = InformationSecurityRegistryEntry
organization = factory.SubFactory(OrganizationFactory)
registry_name = "Реестр лицензий на деятельность по технической защите конфиденциальной информации"
presence_status = "present"
entry_number = "77-001234"
issued_at = factory.LazyAttribute(lambda _: fake.date_this_year())
expires_at = factory.LazyAttribute(lambda _: fake.date_this_year())

View File

@@ -13,6 +13,7 @@ from tests.apps.external_data.factories import (
IndustrialProductFactory,
ProsecutorCheckFactory,
PublicProcurementFactory,
InformationSecurityRegistryEntryFactory,
)
from tests.apps.organization.factories import OrganizationFactory
from tests.apps.user.factories import UserFactory
@@ -89,3 +90,29 @@ class ExternalDataApiTest(APITestCase):
self.assertEqual(procurement_response.data["count"], 1)
self.assertEqual(arbitration_response.status_code, status.HTTP_200_OK)
self.assertEqual(arbitration_response.data["count"], 1)
def test_information_security_registry_entries_filter(self):
InformationSecurityRegistryEntryFactory(
organization=self.organization,
presence_status="present",
)
InformationSecurityRegistryEntryFactory(
organization=self.other_organization,
presence_status="absent",
)
response = self.client.get(
f"/api/v1/information-security-registry-entries/?organization={self.organization.id}"
"&presence_status=present"
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["count"], 1)
result = response.data["results"][0]
self.assertEqual(
result["organization"],
str(self.organization.id),
)
self.assertEqual(result["presence_status"], "present")
self.assertIn("registry_name", result)
self.assertIn("entry_number", result)