Browse Source

Updating tests

pull/160/head
Justin Johnson 8 years ago
parent
commit
bbd964f7ff
1 changed files with 18 additions and 2 deletions
  1. +18
    -2
      edivorce/apps/core/tests.py

+ 18
- 2
edivorce/apps/core/tests.py View File

@ -389,16 +389,32 @@ class UserResponseTestCase(TestCase):
self.assertEqual(is_complete(step, lst)[0], False) self.assertEqual(is_complete(step, lst)[0], False)
# All required question # 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') 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') 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) 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 # Put empty response
UserResponse.objects.filter(question_id='other_orders_detail').update(value="") 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') 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): def test_other_questions(self):
step = 'other_questions' step = 'other_questions'
@ -603,4 +619,4 @@ class UserResponseTestCase(TestCase):
# Helper functions # Helper functions
def create_response(user, question, value): def create_response(user, question, value):
UserResponse.objects.create(bceid_user=user, question=Question.objects.get(key=question), value=value)
UserResponse.objects.create(bceid_user=user, question=Question.objects.get(key=question), value=value)

Loading…
Cancel
Save