diff --git a/tests/applications/modelling_e2e/test_handler.py b/tests/applications/modelling_e2e/test_handler.py index 18a887864..eb3e943c6 100644 --- a/tests/applications/modelling_e2e/test_handler.py +++ b/tests/applications/modelling_e2e/test_handler.py @@ -1458,6 +1458,21 @@ def test_gov_cert_newer_than_stored_survey_wins_and_is_flagged_for_saving() -> N assert chosen_is_fetched is True +def test_gov_cert_is_used_when_nothing_is_stored() -> None: + """Only the gov cert exists: it is the assessment, and it must be persisted.""" + # Arrange + from applications.modelling_e2e.handler import _newer_lodged + + fetched = _lodged_epc("2023-12-01") + + # Act + chosen, chosen_is_fetched = _newer_lodged(None, fetched) + + # Assert + assert chosen is fetched + assert chosen_is_fetched is True + + def test_refetch_epc_false_with_stored_epc_skips_api_call() -> None: """refetch_epc=False + stored lodged EPC present: EpcClientService.get_by_uprn is never called; the stored EPC is used and reaches run_modelling."""