Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
179602c
fix: updated order of responses to match the order of questions
stephhou Mar 30, 2026
6659c65
fix: updated backlinks for height and weight
stephhou Mar 30, 2026
5802945
fix: updated backlink for date of birth
stephhou Mar 30, 2026
cd04aba
fix: updated question base to take change value from GET and POST
stephhou Mar 30, 2026
3fc13d8
fix: updated backlinks for smoking history
stephhou Mar 30, 2026
78c79ab
fix: removed unused backlink
stephhou Mar 30, 2026
9ed8c01
fix: updated function name
stephhou Mar 30, 2026
2d50da1
fix: updated backlink for gender page
stephhou Mar 30, 2026
7af7566
fix: moved tests to correct class
stephhou Mar 30, 2026
6b5051b
fix: updated backlinks for age started smoking
stephhou Mar 30, 2026
593a932
fix: updated asbestos exposure backlink
stephhou Mar 30, 2026
46d28d6
Merge branch 'main' into PPHA-602-Update-conditional-backlinks
stephhou Mar 30, 2026
1cb295e
Merge branch 'main' into PPHA-602-Update-conditional-backlinks
stephhou Mar 30, 2026
c9e350e
Merge branch 'main' into PPHA-602-Update-conditional-backlinks
stephhou Mar 30, 2026
a3edbc4
fix: updated backlinks
stephhou Mar 30, 2026
659ed73
fix: update tests to be more specific
stephhou Mar 30, 2026
1978b48
Merge branch 'main' into PPHA-602-Update-conditional-backlinks
stephhou Mar 30, 2026
9630c1b
Merge branch 'main' into PPHA-602-Update-conditional-backlinks
stephhou Mar 30, 2026
5ca462a
Update lung_cancer_screening/questions/tests/unit/views/test_periods_…
stephhou Mar 30, 2026
fb80a05
fix: renamed tests
stephhou Mar 30, 2026
f5640e9
fix: corrected indentaion
stephhou Mar 30, 2026
0093c39
fix: corrected test name
stephhou Mar 30, 2026
530c738
fix: corrected condition
stephhou Mar 30, 2026
5c1bc4d
fix: updated boolean
stephhou Mar 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions lung_cancer_screening/questions/jinja2/height.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@
'metric': 'centimetres'
} %}

{% block beforeContent %}
<nav>
{{
backLink({
"href": url("questions:check_need_appointment"),
"text": "Back"
})
}}
</nav>
{% endblock beforeContent %}

{% block page_content %}
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">
Expand Down
11 changes: 0 additions & 11 deletions lung_cancer_screening/questions/jinja2/weight.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@
'metric': 'kilograms'
} %}

{% block beforeContent %}
<nav>
{{
backLink({
"href": url("questions:height"),
"text": "Back"
})
}}
</nav>
{% endblock beforeContent %}

{% block page_content %}
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,16 @@ def about_you_responses_items(self):
self.weight,
"questions:weight",
),
self._check_your_answer_item(
"Sex at birth",
self.sex_at_birth,
"questions:sex_at_birth",
),
self._check_your_answer_item(
"Gender identity",
self.gender,
"questions:gender",
),
self._check_your_answer_item(
"Sex at birth",
self.sex_at_birth,
"questions:sex_at_birth",
),
self._check_your_answer_item(
"Ethnic background",
self.ethnicity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ def test_redirects_when_the_user_is_not_eligible(self):

self.assertRedirects(response, reverse("questions:agree_terms_of_use"))

def test_back_link_url_is_responses_if_change_query_param_is_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:age_when_started_smoking", query={"change": "True"})
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_is_relatives_age_when_diagnosed_if_change_query_param_is_not_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:age_when_started_smoking")
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:relatives_age_when_diagnosed"))

def test_responds_successfully(self):
ResponseSetFactory.create(user=self.user, eligible=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ def test_responds_successfully(self):
self.assertEqual(response.status_code, 200)


def test_back_link_url_is_responses_if_change_query_param_is_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:asbestos_exposure", query={"change": "True"})
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))


def test_back_link_url_is_respiratory_conditions_if_change_query_param_is_not_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(reverse("questions:asbestos_exposure"))

self.assertEqual(response.context_data["back_link_url"], reverse("questions:respiratory_conditions"))

@tag("AsbestosExposure")
class TestPostAsbestosExposure(TestCase):
def setUp(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ def test_redirects_when_the_user_is_not_eligible(self):

self.assertRedirects(response, reverse("questions:agree_terms_of_use"))

def test_back_link_url_is_responses_if_change_query_param_is_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:cancer_diagnosis", query={"change": "True"})
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_is_asbestos_exposure_if_change_query_param_is_not_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:cancer_diagnosis")
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:asbestos_exposure"))

def test_responds_successfully(self):
ResponseSetFactory.create(user=self.user, eligible=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ def test_responds_successfully(self):

self.assertEqual(response.status_code, 200)

def test_get_back_link_url_points_to_responses_if_change_query_param_is_true(self):
response = self.client.get(
reverse("questions:date_of_birth") + "?change=True"
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_get_back_link_url_points_to_have_you_ever_smoked_if_change_query_param_is_not_true(self):
response = self.client.get(
reverse("questions:date_of_birth")
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:have_you_ever_smoked"))

@tag("DateOfBirth")
class TestPostDateOfBirth(TestCase):
Expand Down
18 changes: 18 additions & 0 deletions lung_cancer_screening/questions/tests/unit/views/test_education.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ def test_redirects_when_the_user_is_not_eligible(self):

self.assertRedirects(response, reverse("questions:agree_terms_of_use"))

def test_back_link_url_is_responses_if_change_query_param_is_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:education", query={"change": "True"})
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_is_ethnicity_if_change_query_param_is_not_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:education")
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:ethnicity"))

def test_responds_successfully(self):
ResponseSetFactory.create(user=self.user, eligible=True)

Expand Down
16 changes: 16 additions & 0 deletions lung_cancer_screening/questions/tests/unit/views/test_ethnicity.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ def test_redirects_when_the_user_is_not_eligible(self):

self.assertRedirects(response, reverse("questions:agree_terms_of_use"))

def test_back_link_url_is_responses_if_change_query_param_is_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:ethnicity", query={"change": "True"})
)
self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_is_sex_at_birth_if_change_query_param_is_not_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:ethnicity")
)
self.assertEqual(response.context_data["back_link_url"], reverse("questions:sex_at_birth"))

def test_responds_successfully(self):
ResponseSetFactory.create(user=self.user, eligible=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ def test_redirects_when_the_user_is_not_eligible(self):

self.assertRedirects(response, reverse("questions:agree_terms_of_use"))

def test_back_link_url_is_responses_if_change_query_param_is_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:family_history_lung_cancer", query={"change": "True"})
)
self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_is_cancer_diagnosis_if_change_query_param_is_not_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:family_history_lung_cancer")
)
self.assertEqual(response.context_data["back_link_url"], reverse("questions:cancer_diagnosis"))

def test_responds_successfully(self):
ResponseSetFactory.create(user=self.user, eligible=True)

Expand Down
15 changes: 15 additions & 0 deletions lung_cancer_screening/questions/tests/unit/views/test_gender.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ def test_responds_successfully(self):

self.assertEqual(response.status_code, 200)

def test_back_link_url_is_responses_if_change_query_param_is_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:gender", query={"change": "True"})
)
self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_is_weight_if_change_query_param_is_not_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(reverse("questions:gender"))

self.assertEqual(response.context_data["back_link_url"], reverse("questions:weight"))


@tag("Gender")
class TestPostGender(TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@ def test_get_responds_successfully(self):

self.assertEqual(response.status_code, 200)

def test_get_back_link_url_points_to_responses_if_change_query_param_is_true(self):
TermsOfUseResponseFactory.create(
response_set=ResponseSetFactory.create(user=self.user),
value=True
)

response = self.client.get(
reverse("questions:have_you_ever_smoked") + "?change=True"
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_get_back_link_url_points_to_agree_terms_of_use_if_change_query_param_is_not_true(self):
TermsOfUseResponseFactory.create(
response_set=ResponseSetFactory.create(user=self.user),
value=True
)

response = self.client.get(
reverse("questions:have_you_ever_smoked")
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:agree_terms_of_use"))


@tag("HaveYouEverSmoked")
class TestPostHaveYouEverSmoked(TestCase):
Expand Down
19 changes: 19 additions & 0 deletions lung_cancer_screening/questions/tests/unit/views/test_height.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,25 @@ def test_renders_the_imperial_form_if_specified(self):
self.assertContains(response, "Feet")
self.assertContains(response, "Inches")

def test_back_link_url_is_check_your_answers_if_changing_responses(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:height"), {"change": "True"}
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_is_check_need_appointment_if_not_changing_responses(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:height")
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:check_need_appointment"))



@tag("Height")
class TestPostHeight(TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ def test_redirects_when_the_user_is_not_eligible(self):

self.assertRedirects(response, reverse("questions:agree_terms_of_use"))

def test_back_link_url_is_responses_if_change_query_param_is_true(self):
response = self.client.get(
reverse("questions:periods_when_you_stopped_smoking", query={"change": "True"})
)
self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_is_age_when_started_smoking_if_change_query_param_is_not_true(self):
response = self.client.get(
reverse("questions:periods_when_you_stopped_smoking")
)
self.assertEqual(response.context_data["back_link_url"], reverse("questions:age_when_started_smoking"))

def test_responds_successfully(self):
response = self.client.get(reverse("questions:periods_when_you_stopped_smoking"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,29 @@ def test_responds_redirect_for_no_family_history(self):
fetch_redirect_response=False
)

def test_back_link_url_points_to_responses_if_change_query_param_is_true(self):
FamilyHistoryLungCancerResponseFactory(
response_set=ResponseSetFactory.create(user=self.user, eligible=True),
value=FamilyHistoryLungCancerValues.YES
)

response = self.client.get(
reverse("questions:relatives_age_when_diagnosed") + "?change=True"
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_points_to_family_history_lung_cancer_if_change_query_param_is_not_true(self):
FamilyHistoryLungCancerResponseFactory(
response_set=ResponseSetFactory.create(user=self.user, eligible=True),
value=FamilyHistoryLungCancerValues.YES
)

response = self.client.get(
reverse("questions:relatives_age_when_diagnosed")
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:family_history_lung_cancer"))

@tag("RelativesAgeWhenDiagnosed")
class TestPostRelativesAgeWhenDiagnosed(TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ def test_redirects_when_the_user_is_not_eligible(self):

self.assertRedirects(response, reverse("questions:agree_terms_of_use"))

def test_back_link_url_points_to_responses_if_change_query_param_is_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:respiratory_conditions") + "?change=True"
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_points_to_education_if_change_query_param_is_not_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)

response = self.client.get(
reverse("questions:respiratory_conditions")
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:education"))

def test_responds_successfully(self):
ResponseSetFactory.create(user=self.user, eligible=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ def test_redirects_when_the_user_is_not_eligible(self):

self.assertRedirects(response, reverse("questions:agree_terms_of_use"))

def test_back_link_url_points_to_responses_if_change_query_param_is_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)
response = self.client.get(
reverse("questions:sex_at_birth") + "?change=True"
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:responses"))

def test_back_link_url_points_to_gender_if_change_query_param_is_not_true(self):
ResponseSetFactory.create(user=self.user, eligible=True)
response = self.client.get(
reverse("questions:sex_at_birth")
)

self.assertEqual(response.context_data["back_link_url"], reverse("questions:gender"))

def test_responds_successfully(self):
ResponseSetFactory.create(user=self.user, eligible=True)

Expand Down
Loading
Loading