diff --git a/tests/applications/landlord_description_overrides/__init__.py b/tests/applications/landlord_description_overrides/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/applications/landlord_description_overrides/test_build_columns.py b/tests/applications/landlord_description_overrides/test_build_columns.py new file mode 100644 index 00000000..aff2f290 --- /dev/null +++ b/tests/applications/landlord_description_overrides/test_build_columns.py @@ -0,0 +1,27 @@ +"""The landlord-description-overrides handler's column wiring (`_build_columns`). + +A `column_mapping` entry of ``{category -> source header}`` must produce a +ClassifiableColumn that reads the named header and classifies into the +category's enum. This pins the main_fuel category onto the wiring. +""" + +from __future__ import annotations + +from typing import cast + +from applications.landlord_description_overrides.handler import _build_columns +from infrastructure.chatgpt.chatgpt import ChatGPT + + +def test_build_columns_wires_a_main_fuel_classifier_column() -> None: + # Arrange — the factory only stores the injected collaborators, so a bare + # object stands in for the (I/O-bound) ChatGPT client and the DB session. + chat_gpt = cast(ChatGPT, object()) + + # Act + columns = _build_columns({"main_fuel": "Main Fuel"}, chat_gpt, None) + + # Assert — one column, named main_fuel, reading the "Main Fuel" header. + assert len(columns) == 1 + assert columns[0].name == "main_fuel" + assert columns[0].source_column == "Main Fuel"