mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
Behaviour-preserving lift-and-shift of the condition module out of legacy backend/condition/ into domain/condition, infrastructure/condition, infrastructure/postgres/condition_tables.py, repositories/condition, applications/condition, and tests/condition. Imports rewritten to the DDD paths; ConditionPostgres and the ORM models keep the legacy backend.app.db Base/db_session bridges so the existing suite proves behaviour is unchanged (SQLModel + session-DI conversion tracked as a follow-up in ADR-0064). 16 condition tests pass at the new location. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
915 B
Python
34 lines
915 B
Python
import pytest
|
|
from typing import Dict
|
|
from tempfile import NamedTemporaryFile
|
|
|
|
from infrastructure.condition.lookups.uprn_lookup_csv import UprnLookupLocal
|
|
|
|
|
|
@pytest.fixture
|
|
def prop_ref_uprn_csv_file() -> str:
|
|
csv_content = """reference,out_uprn
|
|
ABC123,10000000001
|
|
DEF456,10000000002
|
|
GHI789,10000000003
|
|
"""
|
|
with NamedTemporaryFile(mode="w+", delete=False, suffix=".csv") as tmp:
|
|
tmp.write(csv_content)
|
|
tmp.flush()
|
|
return tmp.name
|
|
|
|
|
|
def test_generate_prop_ref_uprn_from_csv_file(prop_ref_uprn_csv_file: str) -> None:
|
|
# arrange
|
|
uprn_lookup = UprnLookupLocal(prop_ref_uprn_csv_file)
|
|
expected_map: Dict[str, int] = {
|
|
"ABC123": 10000000001,
|
|
"DEF456": 10000000002,
|
|
"GHI789": 10000000003,
|
|
}
|
|
|
|
# act
|
|
actual_map: Dict[str, int] = uprn_lookup.get_property_ref_to_uprn_lookup()
|
|
|
|
# assert
|
|
assert actual_map == expected_map
|