diff --git a/tests/test_frontdoor.py b/tests/test_frontdoor.py index 2be0c960..ebcb6d80 100644 --- a/tests/test_frontdoor.py +++ b/tests/test_frontdoor.py @@ -6,6 +6,7 @@ from django.utils import timezone from help_to_heat.frontdoor import interface +from help_to_heat.frontdoor.consts import country_page from help_to_heat.frontdoor.mock_epc_api import ( MockEPCApi, MockEPCApiWithEPCC, @@ -2105,6 +2106,20 @@ def test_epc_page_shows_epc_info(): assert page.has_one("p:contains('23 July 2010')") +@unittest.mock.patch("help_to_heat.frontdoor.interface.EPCApi", MockEPCApi) +def test_success_page_still_shows_if_journey_cannot_reach_it(): + supplier = "Utilita" + + session_id, _ = _do_happy_flow(supplier=supplier) + + utils.delete_answer_in_session(session_id, country_page) + + client = utils.get_client() + page = client.get(f"/{session_id}/success").follow() + + assert page.has_one(f"h1:contains('Your details have been submitted to {supplier}')") + + def _setup_client_and_page(): client = utils.get_client() page = client.get("/start") diff --git a/tests/utils.py b/tests/utils.py index 3ffaade2..d42e0e3c 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -13,7 +13,7 @@ from django.conf import settings from django.utils import timezone -from help_to_heat import portal, wsgi +from help_to_heat import frontdoor, portal, wsgi from help_to_heat.portal import models __here__ = pathlib.Path(__file__).parent @@ -175,3 +175,7 @@ def create_referral(session_id, data=None, supplier="British Gas", creation_time referral = portal.models.Referral.objects.get() referral.created_at = creation_timestamp referral.save() + + +def delete_answer_in_session(session_id, page_name): + frontdoor.models.Answer.objects.get(session_id=session_id, page_name=page_name).delete()