From f300af6cc332e6e6f3b209ea496540103df89715 Mon Sep 17 00:00:00 2001 From: LJBabbage Date: Fri, 14 Aug 2020 14:55:18 +0100 Subject: [PATCH 1/8] Add actions for list collectors and remove old code --- app/views/handlers/list_collector.py | 8 +-- app/views/handlers/list_remove_question.py | 8 +-- .../handlers/primary_person_list_collector.py | 7 +-- scripts/run_validator.sh | 2 +- ...edirect_to_list_add_question_checkbox.json | 18 +++--- ...n_redirect_to_list_add_question_radio.json | 18 +++--- ...ion_question_within_repeating_section.json | 18 +++--- test_schemas/en/test_individual_response.json | 27 ++++---- .../test_last_viewed_question_guidance.json | 27 ++++---- .../test_list_change_evaluates_sections.json | 27 ++++---- test_schemas/en/test_list_collector.json | 36 +++++------ .../test_list_collector_driving_checkbox.json | 45 ++++++------- .../test_list_collector_driving_question.json | 18 +++--- .../test_list_collector_primary_person.json | 27 ++++---- .../test_list_collector_section_summary.json | 45 ++++++------- .../en/test_list_collector_variants.json | 23 +++---- ...ist_collector_variants_primary_person.json | 32 +++++----- .../en/test_list_summary_on_question.json | 36 +++++------ ...aceholder_based_on_first_item_in_list.json | 18 +++--- test_schemas/en/test_relationships.json | 18 +++--- .../en/test_relationships_primary.json | 27 ++++---- .../en/test_repeating_section_summaries.json | 27 ++++---- ...repeating_sections_with_hub_and_spoke.json | 63 +++++++++---------- test_schemas/en/test_skip_condition_list.json | 18 +++--- .../en/test_variants_first_item_in_list.json | 18 +++--- tests/app/questionnaire/conftest.py | 11 ++-- tests/app/views/contexts/conftest.py | 14 +++-- 27 files changed, 292 insertions(+), 344 deletions(-) diff --git a/app/views/handlers/list_collector.py b/app/views/handlers/list_collector.py index f024cd42b0..e587dec0fd 100644 --- a/app/views/handlers/list_collector.py +++ b/app/views/handlers/list_collector.py @@ -42,10 +42,10 @@ def get_context(self): } def handle_post(self): - if ( - self.form.data[self.rendered_block["add_answer"]["id"]] - == self.rendered_block["add_answer"]["value"] - ): + answer_action = self._get_answer_action() + action_type = answer_action["type"] if answer_action else None + + if action_type == "AddAnswerForListItem": self._is_adding = True self.questionnaire_store_updater.update_answers(self.form.data) diff --git a/app/views/handlers/list_remove_question.py b/app/views/handlers/list_remove_question.py index fcb6cd4c48..a361bf400f 100644 --- a/app/views/handlers/list_remove_question.py +++ b/app/views/handlers/list_remove_question.py @@ -20,10 +20,10 @@ def is_location_valid(self): return True def handle_post(self): - if ( - self.form.data[self.parent_block["remove_answer"]["id"]] - == self.parent_block["remove_answer"]["value"] - ): + answer_action = self._get_answer_action() + action_type = answer_action["type"] if answer_action else None + + if action_type == "RemoveAnswerForListItem": list_name = self.parent_block["for_list"] self.questionnaire_store_updater.remove_list_item_and_answers( list_name, self._current_location.list_item_id diff --git a/app/views/handlers/primary_person_list_collector.py b/app/views/handlers/primary_person_list_collector.py index 443a124a22..82094016a4 100644 --- a/app/views/handlers/primary_person_list_collector.py +++ b/app/views/handlers/primary_person_list_collector.py @@ -23,11 +23,10 @@ def get_next_location_url(self): def handle_post(self): list_name = self.rendered_block["for_list"] + answer_action = self._get_answer_action() + action_type = answer_action["type"] if answer_action else None - if ( - self.form.data[self.rendered_block["add_or_edit_answer"]["id"]] - == self.rendered_block["add_or_edit_answer"]["value"] - ): + if action_type == "AddOrEditAnswerForListItem": self._is_adding = True self.questionnaire_store_updater.update_answers(self.form.data) self._primary_person_id = self.questionnaire_store_updater.add_primary_person( diff --git a/scripts/run_validator.sh b/scripts/run_validator.sh index 3229c64bea..c564bd3eba 100755 --- a/scripts/run_validator.sh +++ b/scripts/run_validator.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -tag=latest +tag=add-answer-action-for-lists docker pull onsdigital/eq-questionnaire-validator:$tag docker run -d -p 5001:5000 "onsdigital/eq-questionnaire-validator:$tag" diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json b/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json index 8ee444d77e..bc45277513 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json @@ -78,14 +78,6 @@ "id": "anyone-else-live-at", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else-live-at-answer", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -98,7 +90,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -180,7 +175,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json index 4331e28378..6a9b09d9f6 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json @@ -78,14 +78,6 @@ "id": "anyone-else-live-at", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else-live-at-answer", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -98,7 +90,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -180,7 +175,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_confirmation_question_within_repeating_section.json b/test_schemas/en/test_confirmation_question_within_repeating_section.json index 450683bffe..aef8061a67 100644 --- a/test_schemas/en/test_confirmation_question_within_repeating_section.json +++ b/test_schemas/en/test_confirmation_question_within_repeating_section.json @@ -41,14 +41,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -61,7 +53,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -132,7 +127,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_individual_response.json b/test_schemas/en/test_individual_response.json index 69cc360db7..ed6cffbac8 100644 --- a/test_schemas/en/test_individual_response.json +++ b/test_schemas/en/test_individual_response.json @@ -76,10 +76,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "household", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -115,7 +111,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -130,14 +129,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "household", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -150,7 +141,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -221,7 +215,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_last_viewed_question_guidance.json b/test_schemas/en/test_last_viewed_question_guidance.json index a1a103b214..b91ab83eb9 100644 --- a/test_schemas/en/test_last_viewed_question_guidance.json +++ b/test_schemas/en/test_last_viewed_question_guidance.json @@ -84,10 +84,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "people", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -123,7 +119,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -207,14 +206,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -227,7 +218,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -316,7 +310,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_list_change_evaluates_sections.json b/test_schemas/en/test_list_change_evaluates_sections.json index d37729c2a6..d9da6ddcaf 100644 --- a/test_schemas/en/test_list_change_evaluates_sections.json +++ b/test_schemas/en/test_list_change_evaluates_sections.json @@ -37,10 +37,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "people", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -76,7 +72,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -91,14 +90,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -111,7 +102,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -182,7 +176,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_list_collector.json b/test_schemas/en/test_list_collector.json index b344ce7123..3376e5b459 100644 --- a/test_schemas/en/test_list_collector.json +++ b/test_schemas/en/test_list_collector.json @@ -46,14 +46,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -66,7 +58,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -141,7 +136,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", @@ -198,14 +196,6 @@ "id": "another-list-collector-block", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "another-anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "another-remove-confirmation", - "value": "Yes" - }, "question": { "id": "another-confirmation-question", "type": "General", @@ -218,7 +208,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -289,7 +282,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_list_collector_driving_checkbox.json b/test_schemas/en/test_list_collector_driving_checkbox.json index e5dd8c146d..bd2b79c468 100644 --- a/test_schemas/en/test_list_collector_driving_checkbox.json +++ b/test_schemas/en/test_list_collector_driving_checkbox.json @@ -49,10 +49,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "people", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes, I usually live here" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -88,7 +84,10 @@ "options": [ { "label": "Yes, I usually live here", - "value": "Yes, I usually live here" + "value": "Yes, I usually live here", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No, I don’t usually live here", @@ -257,14 +256,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes, I need to add a person" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -277,7 +268,10 @@ "options": [ { "label": "Yes, I need to add a person", - "value": "Yes, I need to add a person" + "value": "Yes, I need to add a person", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No, I do not need to add a person", @@ -405,7 +399,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", @@ -444,14 +441,6 @@ "id": "list-collector-temporary-away-stay", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else-temporary-away-stay", - "value": "Yes, I need to add someone" - }, - "remove_answer": { - "id": "remove-confirmation-temporary-away-stay", - "value": "Yes" - }, "question": { "id": "confirmation-question-temporary-away-stay", "type": "General", @@ -484,7 +473,10 @@ "options": [ { "label": "Yes, I need to add someone", - "value": "Yes, I need to add someone" + "value": "Yes, I need to add someone", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": { @@ -632,7 +624,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_list_collector_driving_question.json b/test_schemas/en/test_list_collector_driving_question.json index 57c68ae161..f982546a85 100644 --- a/test_schemas/en/test_list_collector_driving_question.json +++ b/test_schemas/en/test_list_collector_driving_question.json @@ -114,14 +114,6 @@ "id": "anyone-else-live-at", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else-live-at-answer", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -134,7 +126,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -205,7 +200,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_list_collector_primary_person.json b/test_schemas/en/test_list_collector_primary_person.json index 1f1c79ca46..2b2eab6e57 100644 --- a/test_schemas/en/test_list_collector_primary_person.json +++ b/test_schemas/en/test_list_collector_primary_person.json @@ -46,10 +46,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "people", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -85,7 +81,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -169,14 +168,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -189,7 +180,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -278,7 +272,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_list_collector_section_summary.json b/test_schemas/en/test_list_collector_section_summary.json index b4b3a24c56..1870bf1c2f 100644 --- a/test_schemas/en/test_list_collector_section_summary.json +++ b/test_schemas/en/test_list_collector_section_summary.json @@ -107,10 +107,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "people", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -157,7 +153,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -172,14 +171,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -203,7 +194,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -274,7 +268,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", @@ -338,14 +335,6 @@ "id": "visitor-list-collector", "type": "ListCollector", "for_list": "visitors", - "add_answer": { - "id": "any-more-visitors", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-visitor-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-visitor-question", "type": "General", @@ -369,7 +358,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -440,7 +432,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_list_collector_variants.json b/test_schemas/en/test_list_collector_variants.json index d3ec51234a..a70c5ccc89 100644 --- a/test_schemas/en/test_list_collector_variants.json +++ b/test_schemas/en/test_list_collector_variants.json @@ -59,14 +59,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question_variants": [ { "question": { @@ -81,7 +73,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -272,7 +267,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", @@ -303,7 +301,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_list_collector_variants_primary_person.json b/test_schemas/en/test_list_collector_variants_primary_person.json index c8d57dc950..8a35778d2a 100644 --- a/test_schemas/en/test_list_collector_variants_primary_person.json +++ b/test_schemas/en/test_list_collector_variants_primary_person.json @@ -59,10 +59,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "people", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -139,7 +135,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -170,7 +169,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -194,14 +196,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -214,7 +208,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -303,7 +300,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_list_summary_on_question.json b/test_schemas/en/test_list_summary_on_question.json index 5ef57635c9..a7dc5d1c5e 100644 --- a/test_schemas/en/test_list_summary_on_question.json +++ b/test_schemas/en/test_list_summary_on_question.json @@ -46,14 +46,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -66,7 +58,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -137,7 +132,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", @@ -194,14 +192,6 @@ "id": "another-list-collector-block", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "another-anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "another-remove-confirmation", - "value": "Yes" - }, "question": { "id": "another-confirmation-question", "type": "General", @@ -214,7 +204,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -285,7 +278,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json index 7bce490392..785cf81ea4 100644 --- a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json +++ b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json @@ -37,14 +37,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -57,7 +49,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -128,7 +123,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_relationships.json b/test_schemas/en/test_relationships.json index 3bedffba02..20c6133d92 100644 --- a/test_schemas/en/test_relationships.json +++ b/test_schemas/en/test_relationships.json @@ -46,14 +46,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -66,7 +58,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -137,7 +132,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_relationships_primary.json b/test_schemas/en/test_relationships_primary.json index 186793eeb6..7bfd9d5ea2 100644 --- a/test_schemas/en/test_relationships_primary.json +++ b/test_schemas/en/test_relationships_primary.json @@ -33,10 +33,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "people", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -72,7 +68,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -87,14 +86,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -107,7 +98,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -196,7 +190,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_repeating_section_summaries.json b/test_schemas/en/test_repeating_section_summaries.json index 4dac0d76f1..8d9ec297e7 100644 --- a/test_schemas/en/test_repeating_section_summaries.json +++ b/test_schemas/en/test_repeating_section_summaries.json @@ -37,10 +37,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "people", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -76,7 +72,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -91,14 +90,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -111,7 +102,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -182,7 +176,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json index ae80663d47..17513fd920 100644 --- a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json +++ b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json @@ -37,10 +37,6 @@ "id": "primary-person-list-collector", "type": "PrimaryPersonListCollector", "for_list": "people", - "add_or_edit_answer": { - "id": "you-live-here", - "value": "Yes" - }, "add_or_edit_block": { "id": "add-or-edit-primary-person", "type": "PrimaryPersonListAddOrEditQuestion", @@ -76,7 +72,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddOrEditAnswerForListItem" + } }, { "label": "No", @@ -91,14 +90,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -111,7 +102,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -182,7 +176,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", @@ -239,14 +236,6 @@ "id": "another-list-collector-block", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "another-anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "another-remove-confirmation", - "value": "Yes" - }, "question": { "id": "another-confirmation-question", "type": "General", @@ -259,7 +248,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -330,7 +322,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", @@ -375,14 +370,6 @@ "id": "visitors-block", "type": "ListCollector", "for_list": "visitor", - "add_answer": { - "id": "visitors-anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "visitors-remove-confirmation", - "value": "Yes" - }, "question": { "id": "visitors-confirmation-question", "type": "General", @@ -395,7 +382,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -466,7 +456,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_skip_condition_list.json b/test_schemas/en/test_skip_condition_list.json index a2747e7879..bac45bae18 100644 --- a/test_schemas/en/test_skip_condition_list.json +++ b/test_schemas/en/test_skip_condition_list.json @@ -45,14 +45,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -65,7 +57,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -136,7 +131,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/test_schemas/en/test_variants_first_item_in_list.json b/test_schemas/en/test_variants_first_item_in_list.json index 9fc5973ee3..24feb8dfda 100644 --- a/test_schemas/en/test_variants_first_item_in_list.json +++ b/test_schemas/en/test_variants_first_item_in_list.json @@ -37,14 +37,6 @@ "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": { - "id": "anyone-else", - "value": "Yes" - }, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes" - }, "question": { "id": "confirmation-question", "type": "General", @@ -57,7 +49,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", @@ -128,7 +123,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "RemoveAnswerForListItem" + } }, { "label": "No", diff --git a/tests/app/questionnaire/conftest.py b/tests/app/questionnaire/conftest.py index ab041fd10c..e95579257c 100644 --- a/tests/app/questionnaire/conftest.py +++ b/tests/app/questionnaire/conftest.py @@ -158,11 +158,6 @@ def list_collector_variant_schema(): "id": "block1", "type": "ListCollector", "for_list": "people", - "add_answer": {"id": "answer1", "value": "Yes"}, - "remove_answer": { - "id": "remove-confirmation", - "value": "Yes", - }, "question_variants": [ { "question": { @@ -173,6 +168,9 @@ def list_collector_variant_schema(): { "id": "answer1", "label": "Collector Answer 1 Variant Yes", + "action": { + "type": "AddAnswerForListItem" + }, } ], }, @@ -310,6 +308,9 @@ def list_collector_variant_schema(): { "id": "answer1", "label": "Answer 1 Variant Yes", + "action": { + "type": "RemoveAnswerForListItem" + }, } ], }, diff --git a/tests/app/views/contexts/conftest.py b/tests/app/views/contexts/conftest.py index 52224f8148..54724d410f 100644 --- a/tests/app/views/contexts/conftest.py +++ b/tests/app/views/contexts/conftest.py @@ -14,8 +14,6 @@ def list_collector_block(): "id": "list-collector", "type": "ListCollector", "for_list": "people", - "add_answer": {"id": "anyone-else", "value": "Yes"}, - "remove_answer": {"id": "remove-confirmation", "value": "Yes"}, "add_block": { "id": "add-person", "type": "ListAddQuestion", @@ -75,7 +73,11 @@ def list_collector_block(): "mandatory": True, "type": "Radio", "options": [ - {"label": "Yes", "value": "Yes"}, + { + "label": "Yes", + "value": "Yes", + "action": {"type": "RemoveAnswerForListItem"}, + }, {"label": "No", "value": "No"}, ], } @@ -114,7 +116,11 @@ def list_collector_block(): "mandatory": True, "type": "Radio", "options": [ - {"label": "Yes", "value": "Yes"}, + { + "label": "Yes", + "value": "Yes", + "action": {"type": "AddAnswerForListItem"}, + }, {"label": "No", "value": "No"}, ], } From 5a6bec73230fef7284f726d13acc4e3146c3556a Mon Sep 17 00:00:00 2001 From: LJBabbage Date: Fri, 14 Aug 2020 15:47:56 +0100 Subject: [PATCH 2/8] Fix validation errors --- app/views/handlers/list_collector.py | 3 +-- app/views/handlers/list_remove_question.py | 3 +-- app/views/handlers/primary_person_list_collector.py | 3 +-- ...st_answer_action_redirect_to_list_add_question_radio.json | 2 +- test_schemas/en/test_list_collector_variants.json | 5 ++++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/handlers/list_collector.py b/app/views/handlers/list_collector.py index e587dec0fd..776f690702 100644 --- a/app/views/handlers/list_collector.py +++ b/app/views/handlers/list_collector.py @@ -43,9 +43,8 @@ def get_context(self): def handle_post(self): answer_action = self._get_answer_action() - action_type = answer_action["type"] if answer_action else None - if action_type == "AddAnswerForListItem": + if answer_action and answer_action["type"] == "AddAnswerForListItem": self._is_adding = True self.questionnaire_store_updater.update_answers(self.form.data) diff --git a/app/views/handlers/list_remove_question.py b/app/views/handlers/list_remove_question.py index a361bf400f..4793db612c 100644 --- a/app/views/handlers/list_remove_question.py +++ b/app/views/handlers/list_remove_question.py @@ -21,9 +21,8 @@ def is_location_valid(self): def handle_post(self): answer_action = self._get_answer_action() - action_type = answer_action["type"] if answer_action else None - if action_type == "RemoveAnswerForListItem": + if answer_action and answer_action["type"] == "RemoveAnswerForListItem": list_name = self.parent_block["for_list"] self.questionnaire_store_updater.remove_list_item_and_answers( list_name, self._current_location.list_item_id diff --git a/app/views/handlers/primary_person_list_collector.py b/app/views/handlers/primary_person_list_collector.py index 82094016a4..b21c750895 100644 --- a/app/views/handlers/primary_person_list_collector.py +++ b/app/views/handlers/primary_person_list_collector.py @@ -24,9 +24,8 @@ def get_next_location_url(self): def handle_post(self): list_name = self.rendered_block["for_list"] answer_action = self._get_answer_action() - action_type = answer_action["type"] if answer_action else None - if action_type == "AddOrEditAnswerForListItem": + if answer_action and answer_action["type"] == "AddOrEditAnswerForListItem": self._is_adding = True self.questionnaire_store_updater.update_answers(self.form.data) self._primary_person_id = self.questionnaire_store_updater.add_primary_person( diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json index 6a9b09d9f6..f344941f03 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json @@ -177,7 +177,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RemoveAnswerForListItem" } }, { diff --git a/test_schemas/en/test_list_collector_variants.json b/test_schemas/en/test_list_collector_variants.json index a70c5ccc89..2265d2d2f1 100644 --- a/test_schemas/en/test_list_collector_variants.json +++ b/test_schemas/en/test_list_collector_variants.json @@ -107,7 +107,10 @@ "options": [ { "label": "Yes", - "value": "Yes" + "value": "Yes", + "action": { + "type": "AddAnswerForListItem" + } }, { "label": "No", From 65e23b3d9065b59dbe5d548021811ac0a5ce8244 Mon Sep 17 00:00:00 2001 From: LJBabbage Date: Tue, 18 Aug 2020 22:17:12 +0100 Subject: [PATCH 3/8] Update list action names --- app/views/handlers/list_collector.py | 2 +- app/views/handlers/list_remove_question.py | 2 +- .../handlers/primary_person_list_collector.py | 2 +- ...ion_redirect_to_list_add_question_checkbox.json | 4 ++-- ...action_redirect_to_list_add_question_radio.json | 4 ++-- ...irmation_question_within_repeating_section.json | 4 ++-- test_schemas/en/test_individual_response.json | 6 +++--- .../en/test_last_viewed_question_guidance.json | 6 +++--- .../en/test_list_change_evaluates_sections.json | 6 +++--- test_schemas/en/test_list_collector.json | 8 ++++---- .../en/test_list_collector_driving_checkbox.json | 10 +++++----- .../en/test_list_collector_driving_question.json | 4 ++-- .../en/test_list_collector_primary_person.json | 6 +++--- .../en/test_list_collector_section_summary.json | 10 +++++----- test_schemas/en/test_list_collector_variants.json | 8 ++++---- ...est_list_collector_variants_primary_person.json | 8 ++++---- test_schemas/en/test_list_summary_on_question.json | 8 ++++---- ...st_placeholder_based_on_first_item_in_list.json | 4 ++-- test_schemas/en/test_relationships.json | 4 ++-- test_schemas/en/test_relationships_primary.json | 6 +++--- .../en/test_repeating_section_summaries.json | 6 +++--- ...test_repeating_sections_with_hub_and_spoke.json | 14 +++++++------- test_schemas/en/test_skip_condition_list.json | 4 ++-- .../en/test_variants_first_item_in_list.json | 4 ++-- tests/app/questionnaire/conftest.py | 4 ++-- tests/app/views/contexts/conftest.py | 4 ++-- 26 files changed, 74 insertions(+), 74 deletions(-) diff --git a/app/views/handlers/list_collector.py b/app/views/handlers/list_collector.py index 776f690702..1cb576258b 100644 --- a/app/views/handlers/list_collector.py +++ b/app/views/handlers/list_collector.py @@ -44,7 +44,7 @@ def get_context(self): def handle_post(self): answer_action = self._get_answer_action() - if answer_action and answer_action["type"] == "AddAnswerForListItem": + if answer_action and answer_action["type"] == "RedirectToAddBlock": self._is_adding = True self.questionnaire_store_updater.update_answers(self.form.data) diff --git a/app/views/handlers/list_remove_question.py b/app/views/handlers/list_remove_question.py index 4793db612c..f36d829add 100644 --- a/app/views/handlers/list_remove_question.py +++ b/app/views/handlers/list_remove_question.py @@ -22,7 +22,7 @@ def is_location_valid(self): def handle_post(self): answer_action = self._get_answer_action() - if answer_action and answer_action["type"] == "RemoveAnswerForListItem": + if answer_action and answer_action["type"] == "RedirectToRemoveBlock": list_name = self.parent_block["for_list"] self.questionnaire_store_updater.remove_list_item_and_answers( list_name, self._current_location.list_item_id diff --git a/app/views/handlers/primary_person_list_collector.py b/app/views/handlers/primary_person_list_collector.py index b21c750895..82c7b8023e 100644 --- a/app/views/handlers/primary_person_list_collector.py +++ b/app/views/handlers/primary_person_list_collector.py @@ -25,7 +25,7 @@ def handle_post(self): list_name = self.rendered_block["for_list"] answer_action = self._get_answer_action() - if answer_action and answer_action["type"] == "AddOrEditAnswerForListItem": + if answer_action and answer_action["type"] == "RedirectToAddOrEditBlock": self._is_adding = True self.questionnaire_store_updater.update_answers(self.form.data) self._primary_person_id = self.questionnaire_store_updater.add_primary_person( diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json b/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json index bc45277513..e97b15175f 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json @@ -92,7 +92,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -177,7 +177,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json index f344941f03..dd39ea98df 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json @@ -92,7 +92,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -177,7 +177,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_confirmation_question_within_repeating_section.json b/test_schemas/en/test_confirmation_question_within_repeating_section.json index aef8061a67..93b2193d4e 100644 --- a/test_schemas/en/test_confirmation_question_within_repeating_section.json +++ b/test_schemas/en/test_confirmation_question_within_repeating_section.json @@ -55,7 +55,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -129,7 +129,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_individual_response.json b/test_schemas/en/test_individual_response.json index ed6cffbac8..7f3bf36420 100644 --- a/test_schemas/en/test_individual_response.json +++ b/test_schemas/en/test_individual_response.json @@ -113,7 +113,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -143,7 +143,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -217,7 +217,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_last_viewed_question_guidance.json b/test_schemas/en/test_last_viewed_question_guidance.json index b91ab83eb9..29f63448d6 100644 --- a/test_schemas/en/test_last_viewed_question_guidance.json +++ b/test_schemas/en/test_last_viewed_question_guidance.json @@ -121,7 +121,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -220,7 +220,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -312,7 +312,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_list_change_evaluates_sections.json b/test_schemas/en/test_list_change_evaluates_sections.json index d9da6ddcaf..00aaf7751c 100644 --- a/test_schemas/en/test_list_change_evaluates_sections.json +++ b/test_schemas/en/test_list_change_evaluates_sections.json @@ -74,7 +74,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -104,7 +104,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -178,7 +178,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_list_collector.json b/test_schemas/en/test_list_collector.json index 3376e5b459..8d17e03e6d 100644 --- a/test_schemas/en/test_list_collector.json +++ b/test_schemas/en/test_list_collector.json @@ -60,7 +60,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -138,7 +138,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { @@ -210,7 +210,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -284,7 +284,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_list_collector_driving_checkbox.json b/test_schemas/en/test_list_collector_driving_checkbox.json index bd2b79c468..c5d3485f4b 100644 --- a/test_schemas/en/test_list_collector_driving_checkbox.json +++ b/test_schemas/en/test_list_collector_driving_checkbox.json @@ -86,7 +86,7 @@ "label": "Yes, I usually live here", "value": "Yes, I usually live here", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -270,7 +270,7 @@ "label": "Yes, I need to add a person", "value": "Yes, I need to add a person", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -401,7 +401,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { @@ -475,7 +475,7 @@ "label": "Yes, I need to add someone", "value": "Yes, I need to add someone", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -626,7 +626,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_list_collector_driving_question.json b/test_schemas/en/test_list_collector_driving_question.json index f982546a85..0f862ca1ed 100644 --- a/test_schemas/en/test_list_collector_driving_question.json +++ b/test_schemas/en/test_list_collector_driving_question.json @@ -128,7 +128,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -202,7 +202,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_list_collector_primary_person.json b/test_schemas/en/test_list_collector_primary_person.json index 2b2eab6e57..8eddf7bdb4 100644 --- a/test_schemas/en/test_list_collector_primary_person.json +++ b/test_schemas/en/test_list_collector_primary_person.json @@ -83,7 +83,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -182,7 +182,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -274,7 +274,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_list_collector_section_summary.json b/test_schemas/en/test_list_collector_section_summary.json index 1870bf1c2f..fa661405ac 100644 --- a/test_schemas/en/test_list_collector_section_summary.json +++ b/test_schemas/en/test_list_collector_section_summary.json @@ -155,7 +155,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -196,7 +196,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -270,7 +270,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { @@ -360,7 +360,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -434,7 +434,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_list_collector_variants.json b/test_schemas/en/test_list_collector_variants.json index 2265d2d2f1..eb0dffa17b 100644 --- a/test_schemas/en/test_list_collector_variants.json +++ b/test_schemas/en/test_list_collector_variants.json @@ -75,7 +75,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -109,7 +109,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -272,7 +272,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { @@ -306,7 +306,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_list_collector_variants_primary_person.json b/test_schemas/en/test_list_collector_variants_primary_person.json index 8a35778d2a..feaeefc6bf 100644 --- a/test_schemas/en/test_list_collector_variants_primary_person.json +++ b/test_schemas/en/test_list_collector_variants_primary_person.json @@ -137,7 +137,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -171,7 +171,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -210,7 +210,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -302,7 +302,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_list_summary_on_question.json b/test_schemas/en/test_list_summary_on_question.json index a7dc5d1c5e..001540b8ec 100644 --- a/test_schemas/en/test_list_summary_on_question.json +++ b/test_schemas/en/test_list_summary_on_question.json @@ -60,7 +60,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -134,7 +134,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { @@ -206,7 +206,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -280,7 +280,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json index 785cf81ea4..26510ccf96 100644 --- a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json +++ b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json @@ -51,7 +51,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -125,7 +125,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_relationships.json b/test_schemas/en/test_relationships.json index 20c6133d92..aff9f22a77 100644 --- a/test_schemas/en/test_relationships.json +++ b/test_schemas/en/test_relationships.json @@ -60,7 +60,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -134,7 +134,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_relationships_primary.json b/test_schemas/en/test_relationships_primary.json index 7bfd9d5ea2..2366d8b401 100644 --- a/test_schemas/en/test_relationships_primary.json +++ b/test_schemas/en/test_relationships_primary.json @@ -70,7 +70,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -100,7 +100,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -192,7 +192,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_repeating_section_summaries.json b/test_schemas/en/test_repeating_section_summaries.json index 8d9ec297e7..5a51a134dc 100644 --- a/test_schemas/en/test_repeating_section_summaries.json +++ b/test_schemas/en/test_repeating_section_summaries.json @@ -74,7 +74,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -104,7 +104,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -178,7 +178,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json index 17513fd920..35858b25d6 100644 --- a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json +++ b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json @@ -74,7 +74,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddOrEditAnswerForListItem" + "type": "RedirectToAddOrEditBlock" } }, { @@ -104,7 +104,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -178,7 +178,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { @@ -250,7 +250,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -324,7 +324,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { @@ -384,7 +384,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -458,7 +458,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_skip_condition_list.json b/test_schemas/en/test_skip_condition_list.json index bac45bae18..bb3ede6096 100644 --- a/test_schemas/en/test_skip_condition_list.json +++ b/test_schemas/en/test_skip_condition_list.json @@ -59,7 +59,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -133,7 +133,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/test_schemas/en/test_variants_first_item_in_list.json b/test_schemas/en/test_variants_first_item_in_list.json index 24feb8dfda..6cb91b2f30 100644 --- a/test_schemas/en/test_variants_first_item_in_list.json +++ b/test_schemas/en/test_variants_first_item_in_list.json @@ -51,7 +51,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" } }, { @@ -125,7 +125,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" } }, { diff --git a/tests/app/questionnaire/conftest.py b/tests/app/questionnaire/conftest.py index e95579257c..3d3f9db963 100644 --- a/tests/app/questionnaire/conftest.py +++ b/tests/app/questionnaire/conftest.py @@ -169,7 +169,7 @@ def list_collector_variant_schema(): "id": "answer1", "label": "Collector Answer 1 Variant Yes", "action": { - "type": "AddAnswerForListItem" + "type": "RedirectToAddBlock" }, } ], @@ -309,7 +309,7 @@ def list_collector_variant_schema(): "id": "answer1", "label": "Answer 1 Variant Yes", "action": { - "type": "RemoveAnswerForListItem" + "type": "RedirectToRemoveBlock" }, } ], diff --git a/tests/app/views/contexts/conftest.py b/tests/app/views/contexts/conftest.py index 54724d410f..528f15ba44 100644 --- a/tests/app/views/contexts/conftest.py +++ b/tests/app/views/contexts/conftest.py @@ -76,7 +76,7 @@ def list_collector_block(): { "label": "Yes", "value": "Yes", - "action": {"type": "RemoveAnswerForListItem"}, + "action": {"type": "RedirectToRemoveBlock"}, }, {"label": "No", "value": "No"}, ], @@ -119,7 +119,7 @@ def list_collector_block(): { "label": "Yes", "value": "Yes", - "action": {"type": "AddAnswerForListItem"}, + "action": {"type": "RedirectToAddBlock"}, }, {"label": "No", "value": "No"}, ], From c571bfec229a88fd202ac97ebd946c7b401af1d5 Mon Sep 17 00:00:00 2001 From: LJBabbage Date: Thu, 20 Aug 2020 10:27:44 +0100 Subject: [PATCH 4/8] Update action name --- app/views/handlers/list_remove_question.py | 2 +- ...nswer_action_redirect_to_list_add_question_checkbox.json | 2 +- ...t_answer_action_redirect_to_list_add_question_radio.json | 2 +- ...test_confirmation_question_within_repeating_section.json | 2 +- test_schemas/en/test_individual_response.json | 2 +- test_schemas/en/test_last_viewed_question_guidance.json | 2 +- test_schemas/en/test_list_change_evaluates_sections.json | 2 +- test_schemas/en/test_list_collector.json | 4 ++-- test_schemas/en/test_list_collector_driving_checkbox.json | 4 ++-- test_schemas/en/test_list_collector_driving_question.json | 2 +- test_schemas/en/test_list_collector_primary_person.json | 2 +- test_schemas/en/test_list_collector_section_summary.json | 4 ++-- test_schemas/en/test_list_collector_variants.json | 4 ++-- .../en/test_list_collector_variants_primary_person.json | 2 +- test_schemas/en/test_list_summary_on_question.json | 4 ++-- .../en/test_placeholder_based_on_first_item_in_list.json | 2 +- test_schemas/en/test_relationships.json | 2 +- test_schemas/en/test_relationships_primary.json | 2 +- test_schemas/en/test_repeating_section_summaries.json | 2 +- .../en/test_repeating_sections_with_hub_and_spoke.json | 6 +++--- test_schemas/en/test_skip_condition_list.json | 2 +- test_schemas/en/test_variants_first_item_in_list.json | 2 +- tests/app/questionnaire/conftest.py | 2 +- tests/app/views/contexts/conftest.py | 2 +- 24 files changed, 31 insertions(+), 31 deletions(-) diff --git a/app/views/handlers/list_remove_question.py b/app/views/handlers/list_remove_question.py index f36d829add..a73b2371d6 100644 --- a/app/views/handlers/list_remove_question.py +++ b/app/views/handlers/list_remove_question.py @@ -22,7 +22,7 @@ def is_location_valid(self): def handle_post(self): answer_action = self._get_answer_action() - if answer_action and answer_action["type"] == "RedirectToRemoveBlock": + if answer_action and answer_action["type"] == "RemoveAnswersForListItem": list_name = self.parent_block["for_list"] self.questionnaire_store_updater.remove_list_item_and_answers( list_name, self._current_location.list_item_id diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json b/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json index e97b15175f..8b088d28d6 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json @@ -177,7 +177,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json index dd39ea98df..366556d006 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json @@ -177,7 +177,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_confirmation_question_within_repeating_section.json b/test_schemas/en/test_confirmation_question_within_repeating_section.json index 93b2193d4e..b96f5ecbc6 100644 --- a/test_schemas/en/test_confirmation_question_within_repeating_section.json +++ b/test_schemas/en/test_confirmation_question_within_repeating_section.json @@ -129,7 +129,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_individual_response.json b/test_schemas/en/test_individual_response.json index 7f3bf36420..eeccd71d26 100644 --- a/test_schemas/en/test_individual_response.json +++ b/test_schemas/en/test_individual_response.json @@ -217,7 +217,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_last_viewed_question_guidance.json b/test_schemas/en/test_last_viewed_question_guidance.json index 29f63448d6..8d37a0a3c2 100644 --- a/test_schemas/en/test_last_viewed_question_guidance.json +++ b/test_schemas/en/test_last_viewed_question_guidance.json @@ -312,7 +312,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_list_change_evaluates_sections.json b/test_schemas/en/test_list_change_evaluates_sections.json index 00aaf7751c..be9e9b4d70 100644 --- a/test_schemas/en/test_list_change_evaluates_sections.json +++ b/test_schemas/en/test_list_change_evaluates_sections.json @@ -178,7 +178,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_list_collector.json b/test_schemas/en/test_list_collector.json index 8d17e03e6d..7c0c50fde9 100644 --- a/test_schemas/en/test_list_collector.json +++ b/test_schemas/en/test_list_collector.json @@ -138,7 +138,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { @@ -284,7 +284,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_list_collector_driving_checkbox.json b/test_schemas/en/test_list_collector_driving_checkbox.json index c5d3485f4b..feaeb5d8fc 100644 --- a/test_schemas/en/test_list_collector_driving_checkbox.json +++ b/test_schemas/en/test_list_collector_driving_checkbox.json @@ -401,7 +401,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { @@ -626,7 +626,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_list_collector_driving_question.json b/test_schemas/en/test_list_collector_driving_question.json index 0f862ca1ed..16a36460d8 100644 --- a/test_schemas/en/test_list_collector_driving_question.json +++ b/test_schemas/en/test_list_collector_driving_question.json @@ -202,7 +202,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_list_collector_primary_person.json b/test_schemas/en/test_list_collector_primary_person.json index 8eddf7bdb4..ae97d99cf5 100644 --- a/test_schemas/en/test_list_collector_primary_person.json +++ b/test_schemas/en/test_list_collector_primary_person.json @@ -274,7 +274,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_list_collector_section_summary.json b/test_schemas/en/test_list_collector_section_summary.json index fa661405ac..a85ede7562 100644 --- a/test_schemas/en/test_list_collector_section_summary.json +++ b/test_schemas/en/test_list_collector_section_summary.json @@ -270,7 +270,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { @@ -434,7 +434,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_list_collector_variants.json b/test_schemas/en/test_list_collector_variants.json index eb0dffa17b..a92628de92 100644 --- a/test_schemas/en/test_list_collector_variants.json +++ b/test_schemas/en/test_list_collector_variants.json @@ -272,7 +272,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { @@ -306,7 +306,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_list_collector_variants_primary_person.json b/test_schemas/en/test_list_collector_variants_primary_person.json index feaeefc6bf..5b332eac25 100644 --- a/test_schemas/en/test_list_collector_variants_primary_person.json +++ b/test_schemas/en/test_list_collector_variants_primary_person.json @@ -302,7 +302,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_list_summary_on_question.json b/test_schemas/en/test_list_summary_on_question.json index 001540b8ec..00a7418b7a 100644 --- a/test_schemas/en/test_list_summary_on_question.json +++ b/test_schemas/en/test_list_summary_on_question.json @@ -134,7 +134,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { @@ -280,7 +280,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json index 26510ccf96..02e60cf035 100644 --- a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json +++ b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json @@ -125,7 +125,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_relationships.json b/test_schemas/en/test_relationships.json index aff9f22a77..b17f6a7829 100644 --- a/test_schemas/en/test_relationships.json +++ b/test_schemas/en/test_relationships.json @@ -134,7 +134,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_relationships_primary.json b/test_schemas/en/test_relationships_primary.json index 2366d8b401..6e9be52b50 100644 --- a/test_schemas/en/test_relationships_primary.json +++ b/test_schemas/en/test_relationships_primary.json @@ -192,7 +192,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_repeating_section_summaries.json b/test_schemas/en/test_repeating_section_summaries.json index 5a51a134dc..6e5119c54e 100644 --- a/test_schemas/en/test_repeating_section_summaries.json +++ b/test_schemas/en/test_repeating_section_summaries.json @@ -178,7 +178,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json index 35858b25d6..c658ac0ac4 100644 --- a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json +++ b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json @@ -178,7 +178,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { @@ -324,7 +324,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { @@ -458,7 +458,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_skip_condition_list.json b/test_schemas/en/test_skip_condition_list.json index bb3ede6096..81020d8fed 100644 --- a/test_schemas/en/test_skip_condition_list.json +++ b/test_schemas/en/test_skip_condition_list.json @@ -133,7 +133,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/test_schemas/en/test_variants_first_item_in_list.json b/test_schemas/en/test_variants_first_item_in_list.json index 6cb91b2f30..e6c8400b4d 100644 --- a/test_schemas/en/test_variants_first_item_in_list.json +++ b/test_schemas/en/test_variants_first_item_in_list.json @@ -125,7 +125,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" } }, { diff --git a/tests/app/questionnaire/conftest.py b/tests/app/questionnaire/conftest.py index 3d3f9db963..2386ce2970 100644 --- a/tests/app/questionnaire/conftest.py +++ b/tests/app/questionnaire/conftest.py @@ -309,7 +309,7 @@ def list_collector_variant_schema(): "id": "answer1", "label": "Answer 1 Variant Yes", "action": { - "type": "RedirectToRemoveBlock" + "type": "RemoveAnswersForListItem" }, } ], diff --git a/tests/app/views/contexts/conftest.py b/tests/app/views/contexts/conftest.py index 528f15ba44..73f934f6be 100644 --- a/tests/app/views/contexts/conftest.py +++ b/tests/app/views/contexts/conftest.py @@ -76,7 +76,7 @@ def list_collector_block(): { "label": "Yes", "value": "Yes", - "action": {"type": "RedirectToRemoveBlock"}, + "action": {"type": "RemoveAnswersForListItem"}, }, {"label": "No", "value": "No"}, ], From cc3211be85dfb6ed4ecffbdb6da758fd4402ab2d Mon Sep 17 00:00:00 2001 From: LJBabbage Date: Thu, 20 Aug 2020 14:53:28 +0100 Subject: [PATCH 5/8] Update action name --- app/views/handlers/list_remove_question.py | 2 +- ...nswer_action_redirect_to_list_add_question_checkbox.json | 2 +- ...t_answer_action_redirect_to_list_add_question_radio.json | 2 +- ...test_confirmation_question_within_repeating_section.json | 2 +- test_schemas/en/test_individual_response.json | 2 +- test_schemas/en/test_last_viewed_question_guidance.json | 2 +- test_schemas/en/test_list_change_evaluates_sections.json | 2 +- test_schemas/en/test_list_collector.json | 4 ++-- test_schemas/en/test_list_collector_driving_checkbox.json | 4 ++-- test_schemas/en/test_list_collector_driving_question.json | 2 +- test_schemas/en/test_list_collector_primary_person.json | 2 +- test_schemas/en/test_list_collector_section_summary.json | 4 ++-- test_schemas/en/test_list_collector_variants.json | 4 ++-- .../en/test_list_collector_variants_primary_person.json | 2 +- test_schemas/en/test_list_summary_on_question.json | 4 ++-- .../en/test_placeholder_based_on_first_item_in_list.json | 2 +- test_schemas/en/test_relationships.json | 2 +- test_schemas/en/test_relationships_primary.json | 2 +- test_schemas/en/test_repeating_section_summaries.json | 2 +- .../en/test_repeating_sections_with_hub_and_spoke.json | 6 +++--- test_schemas/en/test_skip_condition_list.json | 2 +- test_schemas/en/test_variants_first_item_in_list.json | 2 +- tests/app/questionnaire/conftest.py | 2 +- tests/app/views/contexts/conftest.py | 2 +- 24 files changed, 31 insertions(+), 31 deletions(-) diff --git a/app/views/handlers/list_remove_question.py b/app/views/handlers/list_remove_question.py index a73b2371d6..129417a7b6 100644 --- a/app/views/handlers/list_remove_question.py +++ b/app/views/handlers/list_remove_question.py @@ -22,7 +22,7 @@ def is_location_valid(self): def handle_post(self): answer_action = self._get_answer_action() - if answer_action and answer_action["type"] == "RemoveAnswersForListItem": + if answer_action and answer_action["type"] == "RemoveListItemAndAnswers": list_name = self.parent_block["for_list"] self.questionnaire_store_updater.remove_list_item_and_answers( list_name, self._current_location.list_item_id diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json b/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json index 8b088d28d6..09041d5438 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json @@ -177,7 +177,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json index 366556d006..bd01c6bccd 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json @@ -177,7 +177,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_confirmation_question_within_repeating_section.json b/test_schemas/en/test_confirmation_question_within_repeating_section.json index b96f5ecbc6..4509bde587 100644 --- a/test_schemas/en/test_confirmation_question_within_repeating_section.json +++ b/test_schemas/en/test_confirmation_question_within_repeating_section.json @@ -129,7 +129,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_individual_response.json b/test_schemas/en/test_individual_response.json index eeccd71d26..6d98a6a59b 100644 --- a/test_schemas/en/test_individual_response.json +++ b/test_schemas/en/test_individual_response.json @@ -217,7 +217,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_last_viewed_question_guidance.json b/test_schemas/en/test_last_viewed_question_guidance.json index 8d37a0a3c2..ef3dc8decc 100644 --- a/test_schemas/en/test_last_viewed_question_guidance.json +++ b/test_schemas/en/test_last_viewed_question_guidance.json @@ -312,7 +312,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_list_change_evaluates_sections.json b/test_schemas/en/test_list_change_evaluates_sections.json index be9e9b4d70..0b0d9e7cbf 100644 --- a/test_schemas/en/test_list_change_evaluates_sections.json +++ b/test_schemas/en/test_list_change_evaluates_sections.json @@ -178,7 +178,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_list_collector.json b/test_schemas/en/test_list_collector.json index 7c0c50fde9..eb95707063 100644 --- a/test_schemas/en/test_list_collector.json +++ b/test_schemas/en/test_list_collector.json @@ -138,7 +138,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { @@ -284,7 +284,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_list_collector_driving_checkbox.json b/test_schemas/en/test_list_collector_driving_checkbox.json index feaeb5d8fc..8b1cfc4376 100644 --- a/test_schemas/en/test_list_collector_driving_checkbox.json +++ b/test_schemas/en/test_list_collector_driving_checkbox.json @@ -401,7 +401,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { @@ -626,7 +626,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_list_collector_driving_question.json b/test_schemas/en/test_list_collector_driving_question.json index 16a36460d8..c1f5533de5 100644 --- a/test_schemas/en/test_list_collector_driving_question.json +++ b/test_schemas/en/test_list_collector_driving_question.json @@ -202,7 +202,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_list_collector_primary_person.json b/test_schemas/en/test_list_collector_primary_person.json index ae97d99cf5..d61bc61895 100644 --- a/test_schemas/en/test_list_collector_primary_person.json +++ b/test_schemas/en/test_list_collector_primary_person.json @@ -274,7 +274,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_list_collector_section_summary.json b/test_schemas/en/test_list_collector_section_summary.json index a85ede7562..c9aef78ab5 100644 --- a/test_schemas/en/test_list_collector_section_summary.json +++ b/test_schemas/en/test_list_collector_section_summary.json @@ -270,7 +270,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { @@ -434,7 +434,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_list_collector_variants.json b/test_schemas/en/test_list_collector_variants.json index a92628de92..6e54b261a5 100644 --- a/test_schemas/en/test_list_collector_variants.json +++ b/test_schemas/en/test_list_collector_variants.json @@ -272,7 +272,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { @@ -306,7 +306,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_list_collector_variants_primary_person.json b/test_schemas/en/test_list_collector_variants_primary_person.json index 5b332eac25..13d6da72f7 100644 --- a/test_schemas/en/test_list_collector_variants_primary_person.json +++ b/test_schemas/en/test_list_collector_variants_primary_person.json @@ -302,7 +302,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_list_summary_on_question.json b/test_schemas/en/test_list_summary_on_question.json index 00a7418b7a..4bc7ef2606 100644 --- a/test_schemas/en/test_list_summary_on_question.json +++ b/test_schemas/en/test_list_summary_on_question.json @@ -134,7 +134,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { @@ -280,7 +280,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json index 02e60cf035..0f92260e8b 100644 --- a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json +++ b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json @@ -125,7 +125,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_relationships.json b/test_schemas/en/test_relationships.json index b17f6a7829..9fdcf56f87 100644 --- a/test_schemas/en/test_relationships.json +++ b/test_schemas/en/test_relationships.json @@ -134,7 +134,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_relationships_primary.json b/test_schemas/en/test_relationships_primary.json index 6e9be52b50..11ee23c311 100644 --- a/test_schemas/en/test_relationships_primary.json +++ b/test_schemas/en/test_relationships_primary.json @@ -192,7 +192,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_repeating_section_summaries.json b/test_schemas/en/test_repeating_section_summaries.json index 6e5119c54e..fbd34a01c5 100644 --- a/test_schemas/en/test_repeating_section_summaries.json +++ b/test_schemas/en/test_repeating_section_summaries.json @@ -178,7 +178,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json index c658ac0ac4..cb2ac6100d 100644 --- a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json +++ b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json @@ -178,7 +178,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { @@ -324,7 +324,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { @@ -458,7 +458,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_skip_condition_list.json b/test_schemas/en/test_skip_condition_list.json index 81020d8fed..5f92d5e2e7 100644 --- a/test_schemas/en/test_skip_condition_list.json +++ b/test_schemas/en/test_skip_condition_list.json @@ -133,7 +133,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/test_schemas/en/test_variants_first_item_in_list.json b/test_schemas/en/test_variants_first_item_in_list.json index e6c8400b4d..7562cc6995 100644 --- a/test_schemas/en/test_variants_first_item_in_list.json +++ b/test_schemas/en/test_variants_first_item_in_list.json @@ -125,7 +125,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" } }, { diff --git a/tests/app/questionnaire/conftest.py b/tests/app/questionnaire/conftest.py index 2386ce2970..3e961e66ec 100644 --- a/tests/app/questionnaire/conftest.py +++ b/tests/app/questionnaire/conftest.py @@ -309,7 +309,7 @@ def list_collector_variant_schema(): "id": "answer1", "label": "Answer 1 Variant Yes", "action": { - "type": "RemoveAnswersForListItem" + "type": "RemoveListItemAndAnswers" }, } ], diff --git a/tests/app/views/contexts/conftest.py b/tests/app/views/contexts/conftest.py index 73f934f6be..841cd9e476 100644 --- a/tests/app/views/contexts/conftest.py +++ b/tests/app/views/contexts/conftest.py @@ -76,7 +76,7 @@ def list_collector_block(): { "label": "Yes", "value": "Yes", - "action": {"type": "RemoveAnswersForListItem"}, + "action": {"type": "RemoveListItemAndAnswers"}, }, {"label": "No", "value": "No"}, ], From 771d44316b52ef6a860fc0b74aded400e34133c9 Mon Sep 17 00:00:00 2001 From: LJBabbage Date: Fri, 21 Aug 2020 21:10:41 +0100 Subject: [PATCH 6/8] Rationaise actions --- app/views/handlers/list_collector.py | 2 +- .../handlers/primary_person_list_collector.py | 2 +- app/views/handlers/question.py | 2 +- ...ction_redirect_to_list_add_block_checkbox.json} | 8 ++++---- ...r_action_redirect_to_list_add_block_radio.json} | 8 ++++---- ...irmation_question_within_repeating_section.json | 2 +- test_schemas/en/test_individual_response.json | 4 ++-- .../en/test_last_viewed_question_guidance.json | 6 +++--- .../en/test_list_change_evaluates_sections.json | 4 ++-- test_schemas/en/test_list_collector.json | 4 ++-- .../en/test_list_collector_driving_checkbox.json | 14 +++++++------- .../en/test_list_collector_driving_question.json | 4 ++-- .../en/test_list_collector_primary_person.json | 6 +++--- .../en/test_list_collector_section_summary.json | 6 +++--- test_schemas/en/test_list_collector_variants.json | 4 ++-- ...est_list_collector_variants_primary_person.json | 6 +++--- test_schemas/en/test_list_summary_on_question.json | 4 ++-- ...st_placeholder_based_on_first_item_in_list.json | 2 +- test_schemas/en/test_relationships.json | 2 +- test_schemas/en/test_relationships_primary.json | 4 ++-- .../en/test_repeating_section_summaries.json | 4 ++-- ...test_repeating_sections_with_hub_and_spoke.json | 8 ++++---- test_schemas/en/test_skip_condition_list.json | 2 +- .../en/test_variants_first_item_in_list.json | 2 +- tests/app/questionnaire/conftest.py | 2 +- tests/app/views/contexts/conftest.py | 2 +- ...on_redirect_to_list_add_block_checkbox.spec.js} | 2 +- ...ction_redirect_to_list_add_block_radio.spec.js} | 2 +- ...edirect_to_list_add_question_action_checkbox.py | 8 ++++---- ...e_redirect_to_list_add_question_action_radio.py | 8 ++++---- 30 files changed, 67 insertions(+), 67 deletions(-) rename test_schemas/en/{test_answer_action_redirect_to_list_add_question_checkbox.json => test_answer_action_redirect_to_list_add_block_checkbox.json} (98%) rename test_schemas/en/{test_answer_action_redirect_to_list_add_question_radio.json => test_answer_action_redirect_to_list_add_block_radio.json} (98%) rename tests/functional/spec/{answer_action_redirect_to_list_list_add_question_checkbox.spec.js => answer_action_redirect_to_list_add_block_checkbox.spec.js} (99%) rename tests/functional/spec/{answer_action_redirect_to_list_list_add_question_radio.spec.js => answer_action_redirect_to_list_add_block_radio.spec.js} (99%) diff --git a/app/views/handlers/list_collector.py b/app/views/handlers/list_collector.py index 1cb576258b..f30454c9de 100644 --- a/app/views/handlers/list_collector.py +++ b/app/views/handlers/list_collector.py @@ -44,7 +44,7 @@ def get_context(self): def handle_post(self): answer_action = self._get_answer_action() - if answer_action and answer_action["type"] == "RedirectToAddBlock": + if answer_action and answer_action["type"] == "RedirectToListAddBlock": self._is_adding = True self.questionnaire_store_updater.update_answers(self.form.data) diff --git a/app/views/handlers/primary_person_list_collector.py b/app/views/handlers/primary_person_list_collector.py index 82c7b8023e..cc9e72aca1 100644 --- a/app/views/handlers/primary_person_list_collector.py +++ b/app/views/handlers/primary_person_list_collector.py @@ -25,7 +25,7 @@ def handle_post(self): list_name = self.rendered_block["for_list"] answer_action = self._get_answer_action() - if answer_action and answer_action["type"] == "RedirectToAddOrEditBlock": + if answer_action and answer_action["type"] == "RedirectToListAddBlock": self._is_adding = True self.questionnaire_store_updater.update_answers(self.form.data) self._primary_person_id = self.questionnaire_store_updater.add_primary_person( diff --git a/app/views/handlers/question.py b/app/views/handlers/question.py index efb2b463d2..f917dc42a2 100644 --- a/app/views/handlers/question.py +++ b/app/views/handlers/question.py @@ -15,7 +15,7 @@ class Question(BlockHandler): @staticmethod def _has_redirect_to_list_add_action(answer_action): - return answer_action and answer_action["type"] == "RedirectToListAddQuestion" + return answer_action and answer_action["type"] == "RedirectToListAddBlock" @cached_property def form(self): diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json b/test_schemas/en/test_answer_action_redirect_to_list_add_block_checkbox.json similarity index 98% rename from test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json rename to test_schemas/en/test_answer_action_redirect_to_list_add_block_checkbox.json index 09041d5438..3d6ea965f1 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_checkbox.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_block_checkbox.json @@ -4,9 +4,9 @@ "schema_version": "0.0.1", "data_version": "0.0.3", "survey_id": "0", - "title": "Test RedirectToListAddQuestion action", + "title": "Test RedirectToListAddBlock action", "theme": "default", - "description": "A questionnaire to test RedirectToListAddQuestion answer action", + "description": "A questionnaire to test RedirectToListAddBlock answer action", "metadata": [ { "name": "user_id", @@ -58,7 +58,7 @@ "label": "I think so", "value": "I think so", "action": { - "type": "RedirectToListAddQuestion", + "type": "RedirectToListAddBlock", "params": { "block_id": "add-person", "list_name": "people" @@ -92,7 +92,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json b/test_schemas/en/test_answer_action_redirect_to_list_add_block_radio.json similarity index 98% rename from test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json rename to test_schemas/en/test_answer_action_redirect_to_list_add_block_radio.json index bd01c6bccd..abf7e559d2 100644 --- a/test_schemas/en/test_answer_action_redirect_to_list_add_question_radio.json +++ b/test_schemas/en/test_answer_action_redirect_to_list_add_block_radio.json @@ -4,9 +4,9 @@ "schema_version": "0.0.1", "data_version": "0.0.3", "survey_id": "0", - "title": "Test RedirectToListAddQuestion action", + "title": "Test RedirectToListAddBlock action", "theme": "default", - "description": "A questionnaire to test RedirectToListAddQuestion answer action", + "description": "A questionnaire to test RedirectToListAddBlock answer action", "metadata": [ { "name": "user_id", @@ -58,7 +58,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToListAddQuestion", + "type": "RedirectToListAddBlock", "params": { "block_id": "add-person", "list_name": "people" @@ -92,7 +92,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_confirmation_question_within_repeating_section.json b/test_schemas/en/test_confirmation_question_within_repeating_section.json index 4509bde587..908c7e155c 100644 --- a/test_schemas/en/test_confirmation_question_within_repeating_section.json +++ b/test_schemas/en/test_confirmation_question_within_repeating_section.json @@ -55,7 +55,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_individual_response.json b/test_schemas/en/test_individual_response.json index 6d98a6a59b..e9614957b7 100644 --- a/test_schemas/en/test_individual_response.json +++ b/test_schemas/en/test_individual_response.json @@ -113,7 +113,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -143,7 +143,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_last_viewed_question_guidance.json b/test_schemas/en/test_last_viewed_question_guidance.json index ef3dc8decc..15b0bd3405 100644 --- a/test_schemas/en/test_last_viewed_question_guidance.json +++ b/test_schemas/en/test_last_viewed_question_guidance.json @@ -121,7 +121,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -147,7 +147,7 @@ "block_id": "add-person", "list_name": "people" }, - "type": "RedirectToListAddQuestion" + "type": "RedirectToListAddBlock" }, "label": "Yes", "value": "Yes" @@ -220,7 +220,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_list_change_evaluates_sections.json b/test_schemas/en/test_list_change_evaluates_sections.json index 0b0d9e7cbf..392176589d 100644 --- a/test_schemas/en/test_list_change_evaluates_sections.json +++ b/test_schemas/en/test_list_change_evaluates_sections.json @@ -74,7 +74,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -104,7 +104,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_list_collector.json b/test_schemas/en/test_list_collector.json index eb95707063..3e769ff344 100644 --- a/test_schemas/en/test_list_collector.json +++ b/test_schemas/en/test_list_collector.json @@ -60,7 +60,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { @@ -210,7 +210,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_list_collector_driving_checkbox.json b/test_schemas/en/test_list_collector_driving_checkbox.json index 8b1cfc4376..9c64e6b21d 100644 --- a/test_schemas/en/test_list_collector_driving_checkbox.json +++ b/test_schemas/en/test_list_collector_driving_checkbox.json @@ -86,7 +86,7 @@ "label": "Yes, I usually live here", "value": "Yes, I usually live here", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -124,7 +124,7 @@ "block_id": "add-person", "list_name": "people" }, - "type": "RedirectToListAddQuestion" + "type": "RedirectToListAddBlock" } }, { @@ -135,7 +135,7 @@ "block_id": "add-person", "list_name": "people" }, - "type": "RedirectToListAddQuestion" + "type": "RedirectToListAddBlock" } } ] @@ -182,7 +182,7 @@ "block_id": "add-person", "list_name": "people" }, - "type": "RedirectToListAddQuestion" + "type": "RedirectToListAddBlock" } }, { @@ -193,7 +193,7 @@ "block_id": "add-person", "list_name": "people" }, - "type": "RedirectToListAddQuestion" + "type": "RedirectToListAddBlock" } } ] @@ -270,7 +270,7 @@ "label": "Yes, I need to add a person", "value": "Yes, I need to add a person", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { @@ -475,7 +475,7 @@ "label": "Yes, I need to add someone", "value": "Yes, I need to add someone", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_list_collector_driving_question.json b/test_schemas/en/test_list_collector_driving_question.json index c1f5533de5..51b5cd1187 100644 --- a/test_schemas/en/test_list_collector_driving_question.json +++ b/test_schemas/en/test_list_collector_driving_question.json @@ -75,7 +75,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToListAddQuestion", + "type": "RedirectToListAddBlock", "params": { "block_id": "add-person", "list_name": "people" @@ -128,7 +128,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_list_collector_primary_person.json b/test_schemas/en/test_list_collector_primary_person.json index d61bc61895..5882df8417 100644 --- a/test_schemas/en/test_list_collector_primary_person.json +++ b/test_schemas/en/test_list_collector_primary_person.json @@ -83,7 +83,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -109,7 +109,7 @@ "block_id": "add-person", "list_name": "people" }, - "type": "RedirectToListAddQuestion" + "type": "RedirectToListAddBlock" }, "label": "Yes", "value": "Yes" @@ -182,7 +182,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_list_collector_section_summary.json b/test_schemas/en/test_list_collector_section_summary.json index c9aef78ab5..ae4f4cc817 100644 --- a/test_schemas/en/test_list_collector_section_summary.json +++ b/test_schemas/en/test_list_collector_section_summary.json @@ -155,7 +155,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -196,7 +196,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { @@ -360,7 +360,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_list_collector_variants.json b/test_schemas/en/test_list_collector_variants.json index 6e54b261a5..6abea161ae 100644 --- a/test_schemas/en/test_list_collector_variants.json +++ b/test_schemas/en/test_list_collector_variants.json @@ -75,7 +75,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { @@ -109,7 +109,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_list_collector_variants_primary_person.json b/test_schemas/en/test_list_collector_variants_primary_person.json index 13d6da72f7..0fe30112d8 100644 --- a/test_schemas/en/test_list_collector_variants_primary_person.json +++ b/test_schemas/en/test_list_collector_variants_primary_person.json @@ -137,7 +137,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -171,7 +171,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -210,7 +210,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_list_summary_on_question.json b/test_schemas/en/test_list_summary_on_question.json index 4bc7ef2606..97d981b29b 100644 --- a/test_schemas/en/test_list_summary_on_question.json +++ b/test_schemas/en/test_list_summary_on_question.json @@ -60,7 +60,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { @@ -206,7 +206,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json index 0f92260e8b..bf28db732e 100644 --- a/test_schemas/en/test_placeholder_based_on_first_item_in_list.json +++ b/test_schemas/en/test_placeholder_based_on_first_item_in_list.json @@ -51,7 +51,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_relationships.json b/test_schemas/en/test_relationships.json index 9fdcf56f87..bcc6475bfa 100644 --- a/test_schemas/en/test_relationships.json +++ b/test_schemas/en/test_relationships.json @@ -60,7 +60,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_relationships_primary.json b/test_schemas/en/test_relationships_primary.json index 11ee23c311..5b5e5b34c1 100644 --- a/test_schemas/en/test_relationships_primary.json +++ b/test_schemas/en/test_relationships_primary.json @@ -70,7 +70,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -100,7 +100,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_repeating_section_summaries.json b/test_schemas/en/test_repeating_section_summaries.json index fbd34a01c5..24a92a2efc 100644 --- a/test_schemas/en/test_repeating_section_summaries.json +++ b/test_schemas/en/test_repeating_section_summaries.json @@ -74,7 +74,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -104,7 +104,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json index cb2ac6100d..cce048a9e5 100644 --- a/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json +++ b/test_schemas/en/test_repeating_sections_with_hub_and_spoke.json @@ -74,7 +74,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddOrEditBlock" + "type": "RedirectToListAddBlock" } }, { @@ -104,7 +104,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { @@ -250,7 +250,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { @@ -384,7 +384,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_skip_condition_list.json b/test_schemas/en/test_skip_condition_list.json index 5f92d5e2e7..1319ceb4c1 100644 --- a/test_schemas/en/test_skip_condition_list.json +++ b/test_schemas/en/test_skip_condition_list.json @@ -59,7 +59,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/test_schemas/en/test_variants_first_item_in_list.json b/test_schemas/en/test_variants_first_item_in_list.json index 7562cc6995..0fccbe89ee 100644 --- a/test_schemas/en/test_variants_first_item_in_list.json +++ b/test_schemas/en/test_variants_first_item_in_list.json @@ -51,7 +51,7 @@ "label": "Yes", "value": "Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" } }, { diff --git a/tests/app/questionnaire/conftest.py b/tests/app/questionnaire/conftest.py index 3e961e66ec..8848cd280a 100644 --- a/tests/app/questionnaire/conftest.py +++ b/tests/app/questionnaire/conftest.py @@ -169,7 +169,7 @@ def list_collector_variant_schema(): "id": "answer1", "label": "Collector Answer 1 Variant Yes", "action": { - "type": "RedirectToAddBlock" + "type": "RedirectToListAddBlock" }, } ], diff --git a/tests/app/views/contexts/conftest.py b/tests/app/views/contexts/conftest.py index 841cd9e476..e6ff7aba98 100644 --- a/tests/app/views/contexts/conftest.py +++ b/tests/app/views/contexts/conftest.py @@ -119,7 +119,7 @@ def list_collector_block(): { "label": "Yes", "value": "Yes", - "action": {"type": "RedirectToAddBlock"}, + "action": {"type": "RedirectToListAddBlock"}, }, {"label": "No", "value": "No"}, ], diff --git a/tests/functional/spec/answer_action_redirect_to_list_list_add_question_checkbox.spec.js b/tests/functional/spec/answer_action_redirect_to_list_add_block_checkbox.spec.js similarity index 99% rename from tests/functional/spec/answer_action_redirect_to_list_list_add_question_checkbox.spec.js rename to tests/functional/spec/answer_action_redirect_to_list_add_block_checkbox.spec.js index 97f23a3fb0..e493dc6444 100644 --- a/tests/functional/spec/answer_action_redirect_to_list_list_add_question_checkbox.spec.js +++ b/tests/functional/spec/answer_action_redirect_to_list_add_block_checkbox.spec.js @@ -5,7 +5,7 @@ import AnyoneLiveAtListCollectorRemovePage from "../generated_pages/answer_actio import AnyoneUsuallyLiveAt from "../generated_pages/answer_action_redirect_to_list_add_question_checkbox/anyone-usually-live-at.page"; describe("Answer Action: Redirect To List Add Question (Checkbox)", () => { - describe('Given the user is on a question with a "RedirectToListAddQuestion" action enabled', () => { + describe('Given the user is on a question with a "RedirectToListAddBlock" action enabled', () => { before("Launch survey", () => { browser.openQuestionnaire("test_answer_action_redirect_to_list_add_question_checkbox.json"); }); diff --git a/tests/functional/spec/answer_action_redirect_to_list_list_add_question_radio.spec.js b/tests/functional/spec/answer_action_redirect_to_list_add_block_radio.spec.js similarity index 99% rename from tests/functional/spec/answer_action_redirect_to_list_list_add_question_radio.spec.js rename to tests/functional/spec/answer_action_redirect_to_list_add_block_radio.spec.js index fe135cd32b..12e5bf12db 100644 --- a/tests/functional/spec/answer_action_redirect_to_list_list_add_question_radio.spec.js +++ b/tests/functional/spec/answer_action_redirect_to_list_add_block_radio.spec.js @@ -5,7 +5,7 @@ import AnyoneLiveAtListCollectorRemovePage from "../generated_pages/answer_actio import AnyoneUsuallyLiveAt from "../generated_pages/answer_action_redirect_to_list_add_question_radio/anyone-usually-live-at.page"; describe("Answer Action: Redirect To List Add Question (Radio)", () => { - describe('Given the user is on a question with a "RedirectToListAddQuestion" action enabled', () => { + describe('Given the user is on a question with a "RedirectToListAddBlock" action enabled', () => { before("Launch survey", () => { browser.openQuestionnaire("test_answer_action_redirect_to_list_add_question_radio.json"); }); diff --git a/tests/integration/questionnaire/test_questionnaire_redirect_to_list_add_question_action_checkbox.py b/tests/integration/questionnaire/test_questionnaire_redirect_to_list_add_question_action_checkbox.py index 7bea733b42..4251f5de8f 100644 --- a/tests/integration/questionnaire/test_questionnaire_redirect_to_list_add_question_action_checkbox.py +++ b/tests/integration/questionnaire/test_questionnaire_redirect_to_list_add_question_action_checkbox.py @@ -10,7 +10,7 @@ def test_add_list_question_displayed_before_list_collector_and_return_to_in_url( self ): # Given - self.launchSurvey("test_answer_action_redirect_to_list_add_question_checkbox") + self.launchSurvey("test_answer_action_redirect_to_list_add_block_checkbox") # When self.post({"anyone-usually-live-at-answer": ["I think so", "No"]}) @@ -22,7 +22,7 @@ def test_add_list_question_displayed_before_list_collector_and_return_to_in_url( def test_previous_link_when_list_empty_with_return_to_query_string(self): # Given - self.launchSurvey("test_answer_action_redirect_to_list_add_question_checkbox") + self.launchSurvey("test_answer_action_redirect_to_list_add_block_checkbox") self.post({"anyone-usually-live-at-answer": ["I think so", "No"]}) # When @@ -33,7 +33,7 @@ def test_previous_link_when_list_empty_with_return_to_query_string(self): def test_previous_link_when_list_not_empty(self): # Given - self.launchSurvey("test_answer_action_redirect_to_list_add_question_checkbox") + self.launchSurvey("test_answer_action_redirect_to_list_add_block_checkbox") self.post({"anyone-usually-live-at-answer": ["I think so", "No"]}) self.add_person("John", "Doe") self.post({"anyone-else-live-at-answer": "Yes"}) @@ -48,7 +48,7 @@ def test_previous_link_return_to_list_collector_when_invalid_return_to_block_id( self ): # Given - self.launchSurvey("test_answer_action_redirect_to_list_add_question_checkbox") + self.launchSurvey("test_answer_action_redirect_to_list_add_block_checkbox") self.post({"anyone-usually-live-at-answer": ["I think so"]}) url_with_invalid_return_to = self.last_url + "-invalid" diff --git a/tests/integration/questionnaire/test_questionnaire_redirect_to_list_add_question_action_radio.py b/tests/integration/questionnaire/test_questionnaire_redirect_to_list_add_question_action_radio.py index 52a705f184..d9f07058d0 100644 --- a/tests/integration/questionnaire/test_questionnaire_redirect_to_list_add_question_action_radio.py +++ b/tests/integration/questionnaire/test_questionnaire_redirect_to_list_add_question_action_radio.py @@ -15,7 +15,7 @@ def test_add_list_question_displayed_before_list_collector_and_return_to_in_url( self ): # Given - self.launchSurvey("test_answer_action_redirect_to_list_add_question_radio") + self.launchSurvey("test_answer_action_redirect_to_list_add_block_radio") # When self.post({"anyone-usually-live-at-answer": "Yes"}) @@ -27,7 +27,7 @@ def test_add_list_question_displayed_before_list_collector_and_return_to_in_url( def test_previous_link_when_list_empty_with_return_to_query_string(self): # Given - self.launchSurvey("test_answer_action_redirect_to_list_add_question_radio") + self.launchSurvey("test_answer_action_redirect_to_list_add_block_radio") self.post({"anyone-usually-live-at-answer": "Yes"}) # When @@ -38,7 +38,7 @@ def test_previous_link_when_list_empty_with_return_to_query_string(self): def test_previous_link_when_list_not_empty(self): # Given - self.launchSurvey("test_answer_action_redirect_to_list_add_question_radio") + self.launchSurvey("test_answer_action_redirect_to_list_add_block_radio") self.post({"anyone-usually-live-at-answer": "Yes"}) self.add_person("John", "Doe") self.post({"anyone-else-live-at-answer": "Yes"}) @@ -53,7 +53,7 @@ def test_previous_link_return_to_list_collector_when_invalid_return_to_block_id( self ): # Given - self.launchSurvey("test_answer_action_redirect_to_list_add_question_radio") + self.launchSurvey("test_answer_action_redirect_to_list_add_block_radio") self.post({"anyone-usually-live-at-answer": "Yes"}) url_with_invalid_return_to = self.last_url + "-invalid" From 6db5516fafa88b3916f03c95187d9bf09b7d0cca Mon Sep 17 00:00:00 2001 From: LJBabbage Date: Sun, 23 Aug 2020 13:02:27 +0100 Subject: [PATCH 7/8] Update functional test naming --- ..._action_redirect_to_list_add_block_checkbox.spec.js | 10 +++++----- ...wer_action_redirect_to_list_add_block_radio.spec.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/functional/spec/answer_action_redirect_to_list_add_block_checkbox.spec.js b/tests/functional/spec/answer_action_redirect_to_list_add_block_checkbox.spec.js index e493dc6444..d8efda5043 100644 --- a/tests/functional/spec/answer_action_redirect_to_list_add_block_checkbox.spec.js +++ b/tests/functional/spec/answer_action_redirect_to_list_add_block_checkbox.spec.js @@ -1,13 +1,13 @@ import checkPeopleInList from "../helpers"; -import AnyoneLiveAtListCollector from "../generated_pages/answer_action_redirect_to_list_add_question_checkbox/anyone-else-live-at.page"; -import AnyoneLiveAtListCollectorAddPage from "../generated_pages/answer_action_redirect_to_list_add_question_checkbox/anyone-else-live-at-add.page"; -import AnyoneLiveAtListCollectorRemovePage from "../generated_pages/answer_action_redirect_to_list_add_question_checkbox/anyone-else-live-at-remove.page"; -import AnyoneUsuallyLiveAt from "../generated_pages/answer_action_redirect_to_list_add_question_checkbox/anyone-usually-live-at.page"; +import AnyoneLiveAtListCollector from "../generated_pages/answer_action_redirect_to_list_add_block_checkbox/anyone-else-live-at.page"; +import AnyoneLiveAtListCollectorAddPage from "../generated_pages/answer_action_redirect_to_list_add_block_checkbox/anyone-else-live-at-add.page"; +import AnyoneLiveAtListCollectorRemovePage from "../generated_pages/answer_action_redirect_to_list_add_block_checkbox/anyone-else-live-at-remove.page"; +import AnyoneUsuallyLiveAt from "../generated_pages/answer_action_redirect_to_list_add_block_checkbox/anyone-usually-live-at.page"; describe("Answer Action: Redirect To List Add Question (Checkbox)", () => { describe('Given the user is on a question with a "RedirectToListAddBlock" action enabled', () => { before("Launch survey", () => { - browser.openQuestionnaire("test_answer_action_redirect_to_list_add_question_checkbox.json"); + browser.openQuestionnaire("test_answer_action_redirect_to_list_add_block_checkbox.json"); }); it('When the user selects "No", Then, they should be taken to the list collector.', () => { diff --git a/tests/functional/spec/answer_action_redirect_to_list_add_block_radio.spec.js b/tests/functional/spec/answer_action_redirect_to_list_add_block_radio.spec.js index 12e5bf12db..9a4c6a942a 100644 --- a/tests/functional/spec/answer_action_redirect_to_list_add_block_radio.spec.js +++ b/tests/functional/spec/answer_action_redirect_to_list_add_block_radio.spec.js @@ -1,13 +1,13 @@ import checkPeopleInList from "../helpers"; -import AnyoneLiveAtListCollector from "../generated_pages/answer_action_redirect_to_list_add_question_radio/anyone-else-live-at.page"; -import AnyoneLiveAtListCollectorAddPage from "../generated_pages/answer_action_redirect_to_list_add_question_radio/anyone-else-live-at-add.page"; -import AnyoneLiveAtListCollectorRemovePage from "../generated_pages/answer_action_redirect_to_list_add_question_radio/anyone-else-live-at-remove.page"; -import AnyoneUsuallyLiveAt from "../generated_pages/answer_action_redirect_to_list_add_question_radio/anyone-usually-live-at.page"; +import AnyoneLiveAtListCollector from "../generated_pages/answer_action_redirect_to_list_add_block_radio/anyone-else-live-at.page"; +import AnyoneLiveAtListCollectorAddPage from "../generated_pages/answer_action_redirect_to_list_add_block_radio/anyone-else-live-at-add.page"; +import AnyoneLiveAtListCollectorRemovePage from "../generated_pages/answer_action_redirect_to_list_add_block_radio/anyone-else-live-at-remove.page"; +import AnyoneUsuallyLiveAt from "../generated_pages/answer_action_redirect_to_list_add_block_radio/anyone-usually-live-at.page"; describe("Answer Action: Redirect To List Add Question (Radio)", () => { describe('Given the user is on a question with a "RedirectToListAddBlock" action enabled', () => { before("Launch survey", () => { - browser.openQuestionnaire("test_answer_action_redirect_to_list_add_question_radio.json"); + browser.openQuestionnaire("test_answer_action_redirect_to_list_add_block_radio.json"); }); it('When the user answers "No", Then, they should be taken to straight the list collector.', () => { From ef386a1245e6a8eb980b15109c77bbfa9f4d1d5d Mon Sep 17 00:00:00 2001 From: LJBabbage Date: Tue, 25 Aug 2020 17:10:45 +0100 Subject: [PATCH 8/8] Update validator branch --- scripts/run_validator.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_validator.sh b/scripts/run_validator.sh index c564bd3eba..3229c64bea 100755 --- a/scripts/run_validator.sh +++ b/scripts/run_validator.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -tag=add-answer-action-for-lists +tag=latest docker pull onsdigital/eq-questionnaire-validator:$tag docker run -d -p 5001:5000 "onsdigital/eq-questionnaire-validator:$tag"