From 636894721e7a238362442309053f1615199e7aff Mon Sep 17 00:00:00 2001 From: ariannedee Date: Thu, 10 Sep 2020 10:33:34 -0700 Subject: [PATCH] Add test for Children: What are you asking for? --- .../apps/core/tests/test_step_completeness.py | 45 +++++++++++++++++++ .../apps/core/utils/question_step_mapping.py | 2 + 2 files changed, 47 insertions(+) diff --git a/edivorce/apps/core/tests/test_step_completeness.py b/edivorce/apps/core/tests/test_step_completeness.py index e27bd980..b23ba116 100644 --- a/edivorce/apps/core/tests/test_step_completeness.py +++ b/edivorce/apps/core/tests/test_step_completeness.py @@ -371,6 +371,9 @@ class ChildrenStepCompletenessTestCase(TestCase): response.value = value response.save() + def delete_response(self, questions): + UserResponse.objects.filter(bceid_user=self.user, question_id__in=questions).update(value='') + def test_children_details(self): substep = 'your_children' @@ -441,3 +444,45 @@ class ChildrenStepCompletenessTestCase(TestCase): self.assertFalse(self.is_step_complete(substep)) self.create_response('whose_plan_is_coverage_under', '["My plan","Spouse"]') self.assertTrue(self.is_step_complete(substep)) + + def test_what_are_you_asking_for(self): + substep = 'what_for' + + self.assertFalse(self.is_step_complete(substep)) + self.assertEqual(self.get_children_step_status(substep), 'Not started') + + # All basic required fields + self.create_response('child_support_in_order', 'MATCH') + self.create_response('have_separation_agreement', 'NO') + self.create_response('have_court_order', 'NO') + self.create_response('what_parenting_arrangements', 'Something') + self.create_response('want_parenting_arrangements', 'NO') + self.create_response('child_support_act', 'NO') + self.assertFalse(self.is_step_complete(substep)) + + # Based on child_support_in_order value (MATCH) + self.create_response('order_for_child_support', 'We are asking for X') + self.assertTrue(self.is_step_complete(substep)) + + # Based on child_support_in_order value (DIFF) + self.create_response('child_support_in_order', 'DIFF') + self.assertFalse(self.is_step_complete(substep)) + self.create_response('order_monthly_child_support_amount', '100') + self.create_response('claimants_agree_to_child_support_amount', 'YES') + self.assertTrue(self.is_step_complete(substep)) + self.create_response('claimants_agree_to_child_support_amount', 'NO') + self.create_response('child_support_payment_special_provisions', 'Some special provisions') + self.assertTrue(self.is_step_complete(substep)) + + # Based on child_support_in_order value (NO) + self.create_response('child_support_in_order', 'NO') + self.assertFalse(self.is_step_complete(substep)) + self.create_response('child_support_in_order_reason', 'We will sort it out ourselves') + self.delete_response(['order_for_child_support', 'claimants_agree_to_child_support_amount', 'child_support_payment_special_provisions']) + self.assertTrue(self.is_step_complete(substep)) + + # Other conditionals + self.create_response('want_parenting_arrangements', 'YES') + self.assertFalse(self.is_step_complete(substep)) + self.create_response('order_respecting_arrangement', 'Claimant 1 and Claimant 2 will share parenting time equally between them.') + self.assertTrue(self.is_step_complete(substep)) diff --git a/edivorce/apps/core/utils/question_step_mapping.py b/edivorce/apps/core/utils/question_step_mapping.py index 4821a6bb..5bd5cb91 100644 --- a/edivorce/apps/core/utils/question_step_mapping.py +++ b/edivorce/apps/core/utils/question_step_mapping.py @@ -109,6 +109,8 @@ children_substep_question_mapping = { 'child_support_arrears_amount', }, 'what_for': { + # child_support_in_order is not here because it can get pre-populated, and we don't want + # it to be counted as an "answer" for determining Skipped and Started statuses 'order_monthly_child_support_amount', 'child_support_in_order_reason', 'claimants_agree_to_child_support_amount',