diff --git a/edivorce/apps/core/tests.py b/edivorce/apps/core/tests.py index 5ccd6424..a49ef72a 100644 --- a/edivorce/apps/core/tests.py +++ b/edivorce/apps/core/tests.py @@ -389,16 +389,32 @@ class UserResponseTestCase(TestCase): self.assertEqual(is_complete(step, lst)[0], False) # All required question + + create_response(user, 'name_change_you', 'NO') + self.assertEqual(is_complete(step, lst)[0], False) + + create_response(user, 'name_change_spouse', 'NO') create_response(user, 'other_orders_detail', 'I want more orders') lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response', 'question__required') self.assertEqual(is_complete(step, lst)[0], True) + # make incomplete + UserResponse.objects.filter(question_id='name_change_spouse').update(value="YES") + + lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response', 'question__required') + self.assertEqual(is_complete(step, lst)[0], False) + + create_response(user, 'name_change_spouse_fullname', 'new name') + + lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response', 'question__required') + self.assertEqual(is_complete(step, lst)[0], True) + # Put empty response UserResponse.objects.filter(question_id='other_orders_detail').update(value="") lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response', 'question__required') - self.assertEqual(is_complete(step, lst)[0], False) + self.assertEqual(is_complete(step, lst)[0], True) def test_other_questions(self): step = 'other_questions' @@ -603,4 +619,4 @@ class UserResponseTestCase(TestCase): # Helper functions def create_response(user, question, value): - UserResponse.objects.create(bceid_user=user, question=Question.objects.get(key=question), value=value) \ No newline at end of file + UserResponse.objects.create(bceid_user=user, question=Question.objects.get(key=question), value=value)