mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
34 lines
908 B
Python
34 lines
908 B
Python
import pytest
|
|
from typing import Dict
|
|
from tempfile import NamedTemporaryFile
|
|
|
|
from backend.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
|