diff --git a/lung_cancer_screening/nhsuk_forms/imperial_height_form.py b/lung_cancer_screening/nhsuk_forms/imperial_height_form.py index 655f74bd..92506138 100644 --- a/lung_cancer_screening/nhsuk_forms/imperial_height_form.py +++ b/lung_cancer_screening/nhsuk_forms/imperial_height_form.py @@ -47,13 +47,13 @@ def __init__(self, *args, **kwargs): feet_kwargs = { "error_messages": { - 'invalid': 'Feet must be in whole numbers.', + 'invalid': 'Feet must be in whole numbers', **error_messages, }, } inches_kwargs = { "error_messages": { - 'invalid': 'Inches must be in whole numbers.', + 'invalid': 'Inches must be in whole numbers', **error_messages, }, } diff --git a/lung_cancer_screening/nhsuk_forms/imperial_weight_form.py b/lung_cancer_screening/nhsuk_forms/imperial_weight_form.py index 0e323701..d8f94702 100644 --- a/lung_cancer_screening/nhsuk_forms/imperial_weight_form.py +++ b/lung_cancer_screening/nhsuk_forms/imperial_weight_form.py @@ -48,9 +48,9 @@ def __init__(self, *args, **kwargs): "min_value": 0, "max_value": 50, "error_messages": { - 'invalid': 'Stone must be in whole numbers.', - 'min_value': 'Weight must be between 4 stone and 50 stone.', - 'max_value': 'Weight must be between 4 stone and 50 stone.', + 'invalid': 'Stone must be in whole numbers', + 'min_value': 'Weight must be between 4 stone and 50 stone', + 'max_value': 'Weight must be between 4 stone and 50 stone', **error_messages, }, } @@ -58,9 +58,9 @@ def __init__(self, *args, **kwargs): "min_value": 0, "max_value": 13, "error_messages": { - 'invalid': 'Pounds must be in whole numbers.', - 'min_value': 'Pounds must be between 0 and 13.', - 'max_value': 'Pounds must be between 0 and 13.', + 'invalid': 'Pounds must be in whole numbers', + 'min_value': 'Pounds must be between 0 and 13', + 'max_value': 'Pounds must be between 0 and 13', **error_messages, }, } diff --git a/lung_cancer_screening/questions/forms/asbestos_exposure_form.py b/lung_cancer_screening/questions/forms/asbestos_exposure_form.py index 80f27e28..05e0ac07 100644 --- a/lung_cancer_screening/questions/forms/asbestos_exposure_form.py +++ b/lung_cancer_screening/questions/forms/asbestos_exposure_form.py @@ -16,7 +16,7 @@ def __init__(self, *args, **kwargs): label_classes="nhsuk-fieldset__legend--m", coerce=lambda x: x == 'True', error_messages={ - 'required': 'Select if you have been exposed to asbestos.' + 'required': 'Select if you have been exposed to asbestos' } ) diff --git a/lung_cancer_screening/questions/forms/date_of_birth_form.py b/lung_cancer_screening/questions/forms/date_of_birth_form.py index e3cfe41e..047ffea9 100644 --- a/lung_cancer_screening/questions/forms/date_of_birth_form.py +++ b/lung_cancer_screening/questions/forms/date_of_birth_form.py @@ -18,9 +18,9 @@ def __init__(self, *args, **kwargs): label_is_page_heading=True, hint="For example, 15 3 1965", error_messages={ - 'required': 'Enter your date of birth.', - 'incomplete': 'Enter your full date of birth.', - 'invalid': 'Date of birth must be a real date.' + 'required': 'Enter your date of birth', + 'incomplete': 'Enter your full date of birth', + 'invalid': 'Date of birth must be a real date' } ) diff --git a/lung_cancer_screening/questions/forms/ethnicity_form.py b/lung_cancer_screening/questions/forms/ethnicity_form.py index c6af474b..79775952 100644 --- a/lung_cancer_screening/questions/forms/ethnicity_form.py +++ b/lung_cancer_screening/questions/forms/ethnicity_form.py @@ -18,7 +18,7 @@ def __init__(self, *args, **kwargs): label_is_page_heading=True, hint="Your ethnicity may impact your chances of developing lung cancer.", error_messages={ - 'required': 'Select your ethnic background.' + 'required': 'Select your ethnic background' } ) diff --git a/lung_cancer_screening/questions/forms/gender_form.py b/lung_cancer_screening/questions/forms/gender_form.py index 1a36dc87..59a96df7 100644 --- a/lung_cancer_screening/questions/forms/gender_form.py +++ b/lung_cancer_screening/questions/forms/gender_form.py @@ -18,7 +18,7 @@ def __init__(self, *args, **kwargs): label_is_page_heading=True, hint="This information is used to find your NHS number and match with your GP record.", error_messages={ - 'required': 'Select the option that best describes your gender.' + 'required': 'Select the option that best describes your gender' } ) diff --git a/lung_cancer_screening/questions/forms/imperial_height_form.py b/lung_cancer_screening/questions/forms/imperial_height_form.py index f9ec5794..4946bb55 100644 --- a/lung_cancer_screening/questions/forms/imperial_height_form.py +++ b/lung_cancer_screening/questions/forms/imperial_height_form.py @@ -15,8 +15,8 @@ def __init__(self, *args, **kwargs): required=True, require_all_fields=False, error_messages={ - 'required': 'Enter your height.', - 'incomplete': 'Enter your height.' + 'required': 'Enter your height', + 'incomplete': 'Enter your height' } ) diff --git a/lung_cancer_screening/questions/forms/imperial_weight_form.py b/lung_cancer_screening/questions/forms/imperial_weight_form.py index 2420c6ce..170a2343 100644 --- a/lung_cancer_screening/questions/forms/imperial_weight_form.py +++ b/lung_cancer_screening/questions/forms/imperial_weight_form.py @@ -15,8 +15,8 @@ def __init__(self, *args, **kwargs): required=True, require_all_fields=False, error_messages={ - 'required': 'Enter your weight.', - 'incomplete': 'Enter your weight.' + 'required': 'Enter your weight', + 'incomplete': 'Enter your weight' } ) diff --git a/lung_cancer_screening/questions/forms/metric_height_form.py b/lung_cancer_screening/questions/forms/metric_height_form.py index 73669a8e..a3faf455 100644 --- a/lung_cancer_screening/questions/forms/metric_height_form.py +++ b/lung_cancer_screening/questions/forms/metric_height_form.py @@ -14,7 +14,7 @@ def __init__(self, *args, **kwargs): label="Centimetres", classes="nhsuk-input--width-4", error_messages={ - 'required': 'Enter your height.', + 'required': 'Enter your height', } ) diff --git a/lung_cancer_screening/questions/forms/metric_weight_form.py b/lung_cancer_screening/questions/forms/metric_weight_form.py index 338a68aa..062c918f 100644 --- a/lung_cancer_screening/questions/forms/metric_weight_form.py +++ b/lung_cancer_screening/questions/forms/metric_weight_form.py @@ -15,7 +15,7 @@ def __init__(self, *args, **kwargs): classes="nhsuk-input--width-4", required=True, error_messages={ - 'required': 'Enter your weight.', + 'required': 'Enter your weight', } ) def clean_weight_metric(self): diff --git a/lung_cancer_screening/questions/forms/sex_at_birth_form.py b/lung_cancer_screening/questions/forms/sex_at_birth_form.py index 04c6b324..b5c27b35 100644 --- a/lung_cancer_screening/questions/forms/sex_at_birth_form.py +++ b/lung_cancer_screening/questions/forms/sex_at_birth_form.py @@ -18,7 +18,7 @@ def __init__(self, *args, **kwargs): label_is_page_heading=True, hint="Your sex may impact your chances of developing lung cancer.", error_messages={ - 'required': 'Select your sex at birth.' + 'required': 'Select your sex at birth' } ) diff --git a/lung_cancer_screening/questions/tests/unit/forms/test_asbestos_exposure_form.py b/lung_cancer_screening/questions/tests/unit/forms/test_asbestos_exposure_form.py index 87d63570..cc9c995f 100644 --- a/lung_cancer_screening/questions/tests/unit/forms/test_asbestos_exposure_form.py +++ b/lung_cancer_screening/questions/tests/unit/forms/test_asbestos_exposure_form.py @@ -57,5 +57,5 @@ def test_is_invalid_when_no_option_is_selected(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["asbestos_exposure"], - ["Select if you have been exposed to asbestos."] + ["Select if you have been exposed to asbestos"] ) diff --git a/lung_cancer_screening/questions/tests/unit/forms/test_date_of_birth_form.py b/lung_cancer_screening/questions/tests/unit/forms/test_date_of_birth_form.py index d80c039c..28c796a3 100644 --- a/lung_cancer_screening/questions/tests/unit/forms/test_date_of_birth_form.py +++ b/lung_cancer_screening/questions/tests/unit/forms/test_date_of_birth_form.py @@ -32,7 +32,7 @@ def test_is_invalid_when_no_date_is_provided(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["date_of_birth"], - ["Enter your date of birth."] + ["Enter your date of birth"] ) def test_is_invalid_when_a_partial_date_is_provided(self): @@ -48,7 +48,7 @@ def test_is_invalid_when_a_partial_date_is_provided(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["date_of_birth"], - ["Enter your full date of birth."] + ["Enter your full date of birth"] ) def test_is_invalid_when_an_invalid_date_is_provided(self): @@ -64,7 +64,7 @@ def test_is_invalid_when_an_invalid_date_is_provided(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["date_of_birth"], - ["Date of birth must be a real date."] + ["Date of birth must be a real date"] ) def test_returns_a_date_type(self): diff --git a/lung_cancer_screening/questions/tests/unit/forms/test_ethnicity_form.py b/lung_cancer_screening/questions/tests/unit/forms/test_ethnicity_form.py index 330d8fa6..b9268274 100644 --- a/lung_cancer_screening/questions/tests/unit/forms/test_ethnicity_form.py +++ b/lung_cancer_screening/questions/tests/unit/forms/test_ethnicity_form.py @@ -44,5 +44,5 @@ def test_is_invalid_when_no_option_is_selected(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["ethnicity"], - ["Select your ethnic background."] + ["Select your ethnic background"] ) diff --git a/lung_cancer_screening/questions/tests/unit/forms/test_gender_form.py b/lung_cancer_screening/questions/tests/unit/forms/test_gender_form.py index 0e2b126c..4b24eb12 100644 --- a/lung_cancer_screening/questions/tests/unit/forms/test_gender_form.py +++ b/lung_cancer_screening/questions/tests/unit/forms/test_gender_form.py @@ -44,5 +44,5 @@ def test_is_invalid_when_no_option_is_selected(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["gender"], - ["Select the option that best describes your gender."] + ["Select the option that best describes your gender"] ) diff --git a/lung_cancer_screening/questions/tests/unit/forms/test_imperial_height_form.py b/lung_cancer_screening/questions/tests/unit/forms/test_imperial_height_form.py index c68e6c43..8e43f0de 100644 --- a/lung_cancer_screening/questions/tests/unit/forms/test_imperial_height_form.py +++ b/lung_cancer_screening/questions/tests/unit/forms/test_imperial_height_form.py @@ -60,7 +60,7 @@ def test_is_invalid_with_missing_data(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["height_imperial"], - ["Enter your height."] + ["Enter your height"] ) def test_is_invalid_when_given_a_decimal_feet_value(self): @@ -75,5 +75,5 @@ def test_is_invalid_when_given_a_decimal_feet_value(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["height_imperial"], - ["Feet must be in whole numbers."] + ["Feet must be in whole numbers"] ) diff --git a/lung_cancer_screening/questions/tests/unit/forms/test_imperial_weight_form.py b/lung_cancer_screening/questions/tests/unit/forms/test_imperial_weight_form.py index 4734fd27..04b0e2a9 100644 --- a/lung_cancer_screening/questions/tests/unit/forms/test_imperial_weight_form.py +++ b/lung_cancer_screening/questions/tests/unit/forms/test_imperial_weight_form.py @@ -59,7 +59,7 @@ def test_is_invalid_with_missing_data(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["weight_imperial"], - ["Enter your weight."] + ["Enter your weight"] ) def test_is_invalid_when_given_a_decimal_stone_value(self): @@ -74,5 +74,5 @@ def test_is_invalid_when_given_a_decimal_stone_value(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["weight_imperial"], - ["Stone must be in whole numbers."] + ["Stone must be in whole numbers"] ) diff --git a/lung_cancer_screening/questions/tests/unit/forms/test_metric_weight_form.py b/lung_cancer_screening/questions/tests/unit/forms/test_metric_weight_form.py index 7f13ee17..d4d89a7e 100644 --- a/lung_cancer_screening/questions/tests/unit/forms/test_metric_weight_form.py +++ b/lung_cancer_screening/questions/tests/unit/forms/test_metric_weight_form.py @@ -40,7 +40,7 @@ def test_error_message_when_weight_is_empty(self): } ) self.assertFalse(form.is_valid()) - self.assertEqual(form.errors["weight_metric"], ["Enter your weight."]) + self.assertEqual(form.errors["weight_metric"], ["Enter your weight"]) def test_is_not_valid_without_any_weight_value_set(self): form = MetricWeightForm( @@ -51,7 +51,7 @@ def test_is_not_valid_without_any_weight_value_set(self): } ) self.assertFalse(form.is_valid()) - self.assertEqual(form.errors, {"weight_metric": ["Enter your weight."]}) + self.assertEqual(form.errors, {"weight_metric": ["Enter your weight"]}) # UAT: Error message for weight below minimum (25.4kg) def test_error_message_when_weight_below_minimum(self): diff --git a/lung_cancer_screening/questions/tests/unit/forms/test_sex_at_birth_form.py b/lung_cancer_screening/questions/tests/unit/forms/test_sex_at_birth_form.py index c553cd40..1d2bd5a5 100644 --- a/lung_cancer_screening/questions/tests/unit/forms/test_sex_at_birth_form.py +++ b/lung_cancer_screening/questions/tests/unit/forms/test_sex_at_birth_form.py @@ -44,5 +44,5 @@ def test_is_invalid_when_no_option_is_selected(self): self.assertFalse(form.is_valid()) self.assertEqual( form.errors["sex_at_birth"], - ["Select your sex at birth."] + ["Select your sex at birth"] ) diff --git a/tests/features/validation_errors.feature b/tests/features/validation_errors.feature index 3f7b26ea..f7234db1 100644 --- a/tests/features/validation_errors.feature +++ b/tests/features/validation_errors.feature @@ -4,14 +4,14 @@ Feature: Validation errors When I go to "/date-of-birth" And I submit the form Then I am on "/date-of-birth" - And I see a form error "Enter your date of birth." + And I see a form error "Enter your date of birth" Scenario: Height form errors Given I have started the questionnaire When I go to "/height" And I submit the form Then I am on "/height" - And I see a form error "Enter your height." + And I see a form error "Enter your height" When I fill in and submit my height with "139.6" Then I am on "/height" And I see a form error "Height must be between 139.7cm and 243.8 cm" @@ -24,7 +24,7 @@ Feature: Validation errors When I go to "/height?unit=imperial" And I submit the form Then I am on "/height?unit=imperial" - And I see a form error "Enter your height." + And I see a form error "Enter your height" When I fill in and submit my height with "5.2" feet and "2" inches Then I am on "/height?unit=imperial" And I see a form error "Feet must be in whole numbers" @@ -40,7 +40,7 @@ Feature: Validation errors When I go to "/weight" And I submit the form Then I am on "/weight" - And I see a form error "Enter your weight." + And I see a form error "Enter your weight" When I fill in and submit my weight with "25.3" Then I am on "/weight" And I see a form error "Weight must be between 25.4kg and 317.5kg" @@ -53,7 +53,7 @@ Feature: Validation errors When I go to "/weight?unit=imperial" And I submit the form Then I am on "/weight?unit=imperial" - And I see a form error "Enter your weight." + And I see a form error "Enter your weight" When I fill in and submit my weight with "5.2" stone and "2" pounds Then I am on "/weight?unit=imperial" And I see a form error "Stone must be in whole numbers" @@ -72,21 +72,21 @@ Feature: Validation errors When I go to "/sex-at-birth" And I submit the form Then I am on "/sex-at-birth" - And I see a form error "Select your sex at birth." + And I see a form error "Select your sex at birth" Scenario: Gender form errors Given I have started the questionnaire When I go to "/gender" And I submit the form Then I am on "/gender" - And I see a form error "Select the option that best describes your gender." + And I see a form error "Select the option that best describes your gender" Scenario: Ethnicity form errors Given I have started the questionnaire When I go to "/ethnicity" And I submit the form Then I am on "/ethnicity" - And I see a form error "Select your ethnic background." + And I see a form error "Select your ethnic background" Scenario: Respiratory conditions form errors Given I have started the questionnaire