Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add lei status dto to fi with relations dto #262

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/regtech_user_fi_management/entities/models/dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,23 @@ class Config:
from_attributes = True


class LeiStatusDto(BaseModel):
code: str
name: str
can_file: bool

class Config:
from_attributes = True


class FinancialInstitutionWithRelationsDto(FinancialInstitutionDto):
primary_federal_regulator: FederalRegulatorDto | None = None
hmda_institution_type: InstitutionTypeDto | None = None
sbl_institution_types: List[SblTypeAssociationDetailsDto] = []
hq_address_state: AddressStateDto | None = None
lei_status: LeiStatusDto | None = None
domains: List[FinancialInsitutionDomainDto] = []


class FinancialInstitutionAssociationDto(FinancialInstitutionWithRelationsDto):
approved: bool


class LeiStatusDto(BaseModel):
code: str
name: str
can_file: bool

class Config:
from_attributes = True
6 changes: 4 additions & 2 deletions tests/api/routers/test_institutions_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ def test_get_associated_institutions(
FinancialInstitutionDao(
name="Test Bank 234",
lei="TESTBANK234000000000",
lei_status_code="ISSUED",
lei_status=LeiStatusDao(code="ISSUED", name="Issued", can_file=True),
lei_status_code="LAPSED",
lei_status=LeiStatusDao(code="LAPSED", name="Lapsed", can_file=False),
domains=[FinancialInstitutionDomainDao(domain="test234.bank", lei="TESTBANK234000000000")],
tax_id="12-3456879",
rssd_id=6879,
Expand Down Expand Up @@ -517,7 +517,9 @@ def test_get_associated_institutions(
inst1 = next(filter(lambda inst: inst["lei"] == "TESTBANK123000000000", data))
inst2 = next(filter(lambda inst: inst["lei"] == "TESTBANK234000000000", data))
assert inst1["approved"] is False
assert inst1["lei_status"]["can_file"] is True
assert inst2["approved"] is True
assert inst2["lei_status"]["can_file"] is False

def test_get_associated_institutions_with_no_institutions(
self, app_fixture: FastAPI, auth_mock: Mock, get_institutions_mock: Mock
Expand Down
Loading