def test_is_confirmation(self): survey_json = { 'sections': [{ 'id': 'section-1', 'groups': [{ 'id': 'group-1', 'blocks': [ { 'id': 'block-1', 'type': 'Confirmation' } ] }] }] } schema = QuestionnaireSchema(survey_json) self.assertTrue(schema.is_confirmation_section(schema.get_section('section-1'))) self.assertTrue(schema.is_confirmation_group(schema.get_group('group-1'))) self.assertFalse(schema.is_summary_section(schema.get_section('section-1'))) self.assertFalse(schema.is_summary_group(schema.get_group('group-1')))
def test_get_list_collector_for_list(list_collector_variant_schema): schema = QuestionnaireSchema(list_collector_variant_schema) section = schema.get_section("section") result = QuestionnaireSchema.get_list_collector_for_list(section, for_list="people") assert result["id"] == "block1" filtered_result = QuestionnaireSchema.get_list_collector_for_list( section, for_list="people") assert filtered_result == result no_result = QuestionnaireSchema.get_list_collector_for_list( section, for_list="not-valid") assert no_result is None
def test_get_section(single_question_schema): schema = QuestionnaireSchema(single_question_schema) section = schema.get_section("section1") assert section["title"] == "Section 1"