Пример #1
0
    def test_question_with_no_answers_should_not_be_skipped(self):
        # Given
        answers = {}
        answer_schema = {
            'id': 'answer_1',
            'title': '',
            'type': '',
            'label': ''
        }
        skip_condition = {
            'when': [{
                'id': 'answer_1',
                'condition': 'equals',
                'value': 'skip me'
            }]
        }
        question_schema = {
            'id': 'question_id',
            'title': 'question_title',
            'type': 'GENERAL',
            'answers': [answer_schema],
            'skip_condition': skip_condition
        }

        # When
        question = Question(question_schema, answers)

        # Then
        self.assertFalse(question.is_skipped(answers))
Пример #2
0
 def _build_questions(block_id, section_schema, answers):
     questions = []
     for question_schema in section_schema["questions"]:
         question = Question(block_id, question_schema, answers)
         if not question.is_skipped(answers):
             questions.append(question)
     return questions
Пример #3
0
 def _build_questions(section_schema, answers):
     questions = []
     for question_schema in section_schema['questions']:
         question = Question(question_schema, answers)
         if not question.is_skipped(answers):
             questions.append(question)
     return questions
Пример #4
0
    def test_question_with_no_answers_should_not_be_skipped(self):
        # Given
        answers = {}
        answer_schema = {'id': 'answer_1', 'title': '', 'type': '', 'label': ''}
        skip_condition = {'when': {'id': 'answer_1', 'condition': 'equals', 'value': 'skip me'}}
        question_schema = {'id': 'question_id', 'title': 'question_title', 'type': 'GENERAL', 'answers': [answer_schema],
                           'skip_condition': skip_condition}

        # When
        question = Question('1', question_schema, answers)

        # Then
        self.assertFalse(question.is_skipped(answers))