Skip to content

Commit

Permalink
PC-1347: add verifying test
Browse files Browse the repository at this point in the history
  • Loading branch information
samyou-softwire committed Nov 6, 2024
1 parent 1d8a048 commit 29a2040
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
15 changes: 15 additions & 0 deletions tests/test_frontdoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 5 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

0 comments on commit 29a2040

Please sign in to comment.