Esempio n. 1
0
    def test_group_has_questions_returns_true_when_group_has_questionnaire_blocks(
            self):
        survey_json = {
            'sections': [{
                'id':
                'section1',
                'groups': [{
                    'id':
                    'question-group',
                    'blocks': [{
                        'id': 'introduction',
                        'type': 'Introduction'
                    }, {
                        'id': 'question',
                        'type': 'Question'
                    }]
                }]
            }]
        }

        schema = QuestionnaireSchema(survey_json)

        has_questions = schema.group_has_questions('question-group')

        self.assertTrue(has_questions)
    def test_group_has_questions_returns_false_when_group_doesnt_have_questionnaire_blocks(self):
        survey_json = {
            'sections': [{
                'id': 'section1',
                'groups': [{
                    'id': 'non-question-group',
                    'blocks': [
                        {
                            'id': 'summary-block',
                            'type': 'Summary'
                        }
                    ]
                }]
            }]
        }

        schema = QuestionnaireSchema(survey_json)

        has_questions = schema.group_has_questions('non-question-group')

        self.assertFalse(has_questions)