Skip to content

Commit 1eef186

Browse files
committed
Fix broken tests
1 parent fca8a7f commit 1eef186

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

lung_cancer_screening/core/tests/acceptance/test_cannot_change_answers_after_submission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_cannot_change_responses_once_checked_and_submitted(self):
4949
fill_in_and_submit_gender(page, "Male")
5050
fill_in_and_submit_ethnicity(page, "White")
5151
page.click("text=Continue") # education
52-
fill_in_and_submit_respiratory_conditions(page, "None of the above")
52+
fill_in_and_submit_respiratory_conditions(page, "No, I have not had any of these respiratory conditions")
5353
fill_in_and_submit_asbestos_exposure(page, "No")
5454
page.click("text=Continue") # cancer diagnosis
5555
page.click("text=Continue") # family history

lung_cancer_screening/questions/jinja2/responses.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<li>Which of these best describes you? {{ response_set.get_gender_display() }}</li>
2525
<li>What is your ethnic background? {{ response_set.get_ethnicity_display() }}</li>
2626
<li>Have you ever worked in a job where you might have been exposed to asbestos? {{ "Yes" if response_set.asbestos_exposure else "No" }}</li>
27-
<li>Have you ever been diagnosed with any of the following respiratory conditions? {{ response_set.respiratory_conditions }}</li>
27+
<li>Have you ever been diagnosed with any of the following respiratory conditions? {{ response_set.formatted_respiratory_conditions }}</li>
2828
</ul>
2929
<form action="{{ request.path }}" method="post">
3030
{{ csrf_input }}

lung_cancer_screening/questions/models/response_set.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,14 @@ def formatted_weight(self):
163163
value = Decimal(self.weight_imperial)
164164
return f"{value // 14} stone {value % 14} pounds"
165165

166+
@property
167+
def formatted_respiratory_conditions(self):
168+
if not self.respiratory_conditions:
169+
return None
170+
# Get the display values for each code
171+
display_values = [
172+
RespiratoryConditionValues(code).label
173+
for code in self.respiratory_conditions
174+
]
175+
return ", ".join(display_values)
176+

lung_cancer_screening/questions/tests/unit/views/test_respiratory_conditions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_get_contains_the_correct_form_fields(self):
3737
self.assertContains(response, "Chronic bronchitis")
3838
self.assertContains(response, "Tuberculosis (TB)")
3939
self.assertContains(response, "Chronic obstructive pulmonary disease (COPD)")
40-
self.assertContains(response, "None of the above")
40+
self.assertContains(response, "No, I have not had any of these respiratory conditions")
4141

4242
def test_post_redirects_if_the_participant_does_not_exist(self):
4343
session = self.client.session

0 commit comments

Comments
 (0)