DKB_ARMKA/api/tests/unit/test_schemas_unit.py
PotapovaA ba172f8e99 init
2026-09-15 15:53:46 +03:00

39 lines
1.0 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.

import pytest
from pydantic import ValidationError
from src.domain.schemas import MembershipRowCreate, MembershipRowUpdate, OrganizationCreate, RefOrgTypeCreate
def test_ref_org_type_validates_type_code_length():
with pytest.raises(ValidationError):
RefOrgTypeCreate(
type_code="TOO_LONG_CODE",
type_name="Test type",
description="Test description",
)
def test_membership_create_rejects_share_pct_above_100():
with pytest.raises(ValidationError):
MembershipRowCreate(
group_id="GK001",
org_id=1,
share_pct=150,
)
def test_membership_update_rejects_negative_share_pct():
with pytest.raises(ValidationError):
MembershipRowUpdate(share_pct=-0.1)
def test_organization_create_rejects_too_short_inn():
with pytest.raises(ValidationError):
OrganizationCreate(
inn="123456789",
kpp="770101001",
full_name="ООО Тест",
org_type_code="UL",
is_resident=True,
)