Skip to content

Commit 5bd0b12

Browse files
authored
Merge pull request #134 from NHSDigital/PPHA-403-questionairre-framework
PPHA-403: Questionairre framework
2 parents 66a2733 + 3704ef6 commit 5bd0b12

26 files changed

+253
-164
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name": "Ubuntu",
3-
"image": "mcr.microsoft.com/devcontainers/base:noble",
3+
"build": {
4+
"dockerfile": "dockerfile"
5+
},
46
"features": {
57
"ghcr.io/devcontainers/features/docker-in-docker:2": {
68
"moby": true,
@@ -21,11 +23,14 @@
2123
"installOhMyZshConfig": true,
2224
"configureZshAsDefaultShell": true
2325
},
26+
"ghcr.io/devcontainers/features/terraform:1": {},
2427
"ghcr.io/devcontainers-extra/features/zsh-plugins:0": {
2528
"plugins": "zsh-autosuggestions zsh-syntax-highlighting",
2629
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions.git https://github.com/zsh-users/zsh-syntax-highlighting.git"
2730
}
2831
},
32+
"workspaceMount": "source=./,target=/app,type=bind,consistency=cached",
33+
"workspaceFolder": "/app",
2934
"postCreateCommand": "pipx install pre-commit && make config && echo 'export GPG_TTY=$TTY' | cat - ~/.zshrc > temp && mv temp ~/.zshrc",
3035
"mounts": [
3136
"source=${localEnv:HOME}/.gnupg,target=/home/vscode/.gnupg,type=bind,consistency=cached"

.devcontainer/dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM mcr.microsoft.com/devcontainers/base:noble
2+
3+
COPY *.crt /usr/local/share/ca-certificates/
4+
5+
RUN update-ca-certificates

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ lung_cancer_screening/assets/compiled/*
1818
!lung_cancer_screening/assets/compiled/.gitkeep
1919
.DS_Store
2020
.venv
21+
.devcontainer/ca.crt

lung_cancer_screening/core/tests/acceptance/test_cannot_change_answers_after_submission.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ def test_cannot_change_responses_once_checked_and_submitted(self):
4747
fill_in_and_submit_sex_at_birth(page, "Male")
4848
fill_in_and_submit_gender(page, "Male")
4949
fill_in_and_submit_ethnicity(page, "White")
50+
page.click("text=Continue") # education
51+
page.click("text=Continue") # respiratory conditions
5052
fill_in_and_submit_asbestos_exposure(page, "No")
51-
53+
page.click("text=Continue") # cancer diagnosis
54+
page.click("text=Continue") # family history
5255
page.click("text=Submit")
5356

5457
page.goto(f"{self.live_server_url}/start")

lung_cancer_screening/core/tests/acceptance/test_questionnaire.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,34 @@ def test_full_questionnaire_user_journey(self):
8888

8989
expect(page).to_have_url(f"{self.live_server_url}/ethnicity")
9090
expect_back_link_to_have_url(page, "/gender")
91-
9291
fill_in_and_submit_ethnicity(page, "White")
9392

94-
expect(page).to_have_url(f"{self.live_server_url}/asbestos-exposure")
93+
expect(page).to_have_url(f"{self.live_server_url}/education")
9594
expect_back_link_to_have_url(page, "/ethnicity")
95+
page.click("text=Continue")
9696

97+
expect(page).to_have_url(f"{self.live_server_url}/respiratory-conditions")
98+
expect_back_link_to_have_url(page, "/education")
99+
page.click("text=Continue")
100+
101+
expect(page).to_have_url(f"{self.live_server_url}/asbestos-exposure")
102+
expect_back_link_to_have_url(page, "/respiratory-conditions")
97103
fill_in_and_submit_asbestos_exposure(page, "No")
98104

99-
expect(page).to_have_url(f"{self.live_server_url}/responses")
105+
expect(page).to_have_url(f"{self.live_server_url}/cancer-diagnosis")
100106
expect_back_link_to_have_url(page, "/asbestos-exposure")
107+
page.click("text=Continue")
108+
109+
expect(page).to_have_url(f"{self.live_server_url}/family-history-lung-cancer")
110+
expect_back_link_to_have_url(page, "/cancer-diagnosis")
111+
page.click("text=Continue")
112+
113+
expect(page).to_have_url(f"{self.live_server_url}/responses")
114+
expect_back_link_to_have_url(page, "/family-history-lung-cancer")
101115

102116
responses = page.locator(".responses")
103117
expect(responses).to_contain_text("Have you ever smoked? Yes, I used to smoke regularly")
104-
expect(responses).to_contain_text(
105-
age.strftime("What is your date of birth? %Y-%m-%d"))
118+
expect(responses).to_contain_text(age.strftime("What is your date of birth? %Y-%m-%d"))
106119
expect(responses).to_contain_text(f"What is your height? {feet} feet {inches} inches")
107120
expect(responses).to_contain_text(f"What is your weight? {weight_stone} stone {weight_pound} pound")
108121
expect(responses).to_contain_text("What was your sex at birth? Male")

lung_cancer_screening/questions/forms/gender_form.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django import forms
22

3-
from ...nhsuk_forms.typed_choice_field import TypedChoiceField
3+
from ...nhsuk_forms.choice_field import ChoiceField
44
from ..models.response_set import ResponseSet, GenderValues
55

66
class GenderForm(forms.ModelForm):
@@ -10,7 +10,7 @@ def __init__(self, *args, **kwargs):
1010
super().__init__(*args, **kwargs)
1111
self.instance.participant = self.participant
1212

13-
self.fields["gender"] = TypedChoiceField(
13+
self.fields["gender"] = ChoiceField(
1414
choices=GenderValues.choices,
1515
widget=forms.RadioSelect,
1616
label="Which of these best describes you?",

lung_cancer_screening/questions/forms/sex_at_birth_form.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django import forms
22

3-
from ...nhsuk_forms.typed_choice_field import TypedChoiceField
3+
from ...nhsuk_forms.choice_field import ChoiceField
44
from ..models.response_set import ResponseSet, SexAtBirthValues
55

66
class SexAtBirthForm(forms.ModelForm):
@@ -10,7 +10,7 @@ def __init__(self, *args, **kwargs):
1010
super().__init__(*args, **kwargs)
1111
self.instance.participant = self.participant
1212

13-
self.fields["sex_at_birth"] = TypedChoiceField(
13+
self.fields["sex_at_birth"] = ChoiceField(
1414
choices=SexAtBirthValues.choices,
1515
widget=forms.RadioSelect,
1616
label="What was your sex at birth?",

lung_cancer_screening/questions/jinja2/asbestos_exposure.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{% block beforeContent %}
77
{{
88
backLink({
9-
"href": url("questions:ethnicity"),
9+
"href": url("questions:respiratory_conditions"),
1010
"text": "Back"
1111
})
1212
}}

lung_cancer_screening/questions/jinja2/date_of_birth.jinja

Lines changed: 0 additions & 34 deletions
This file was deleted.

lung_cancer_screening/questions/jinja2/gender.jinja

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)