Exemplo n.º 1
0
    def test_should_return_date_and_unique_id_fields_from_questionnaire(self):
        fields = [
            TextField("Some word question", "q1", "Some word question"),
            UniqueIdField("goats", "What goat are you reporting on?", "q2",
                          "What goat are you reporting on?"),
            DateField("When did you buy the goat?", "q3",
                      "When did you buy the goat?", "dd.mm.yyyy"),
            DateField("When did you sell the goat?", "q4",
                      "When did you sell the goat?", "mm.yyyy")
        ]

        fields_array = get_filterable_fields(fields, [])

        self.assertEqual(len(fields_array), 3)
        self.assertDictEqual(fields_array[0], {
            'type': 'unique_id',
            'code': 'q2',
            'entity_type': 'goats'
        })
        self.assertDictEqual(
            fields_array[1], {
                'type': 'date',
                'code': 'q3',
                'label': 'When did you buy the goat?',
                'is_month_format': False,
                'format': 'dd.mm.yyyy'
            })
        self.assertDictEqual(
            fields_array[2], {
                'type': 'date',
                'code': 'q4',
                'label': 'When did you sell the goat?',
                'is_month_format': True,
                'format': 'mm.yyyy'
            })
Exemplo n.º 2
0
    def test_should_show_previous_submissions_in_old_format_after_change_date_format(
            self):
        eid_field = TextField(label="What is associated entity?",
                              code="EID",
                              name="What is associatéd entity?",
                              entity_question_flag=True,
                              ddtype=self.ddtype)
        rp_field = DateField(label="Report date",
                             code="RD",
                             name="What is réporting date?",
                             date_format="dd.mm.yyyy",
                             event_time_field_flag=True,
                             ddtype=self.ddtype)

        form_model = FormModelBuilder(self.manager, ['clinic'],
                                      form_code='cli001').add_fields(
                                          eid_field, rp_field).build()

        self.submit_data({
            'form_code': 'cli001',
            'EID': 'cid001',
            'RD': '12.12.2012'
        })

        rp_field = DateField(label="Report date",
                             code="RD",
                             name="What is réporting date?",
                             date_format="mm.yyyy",
                             event_time_field_flag=True,
                             ddtype=self.ddtype)
        self._edit_fields(form_model, rp_field)
        self.submit_data({
            'form_code': 'cli001',
            'EID': 'cid001',
            'RD': '08.2012'
        })

        rp_field = DateField(label="Report date",
                             code="RD",
                             name="What is réporting date?",
                             date_format="mm.dd.yyyy",
                             event_time_field_flag=True,
                             ddtype=self.ddtype)
        self._edit_fields(form_model, rp_field)
        self.submit_data({
            'form_code': 'cli001',
            'EID': 'cid001',
            'RD': '12.24.2012'
        })

        submissions = successful_submissions(self.manager,
                                             form_model.form_code)
        analyzer = SubmissionAnalyzer(form_model, self.manager, self.org_id,
                                      submissions)
        values = analyzer.get_raw_values()
        reporting_periods = map(lambda value: value[2], values)

        self.assertIn('08.2012', reporting_periods)
        self.assertIn('12.12.2012', reporting_periods)
        self.assertIn('12.24.2012', reporting_periods)
 def test_should_update_submission_index_date_field_with_current_format(
         self):
     dd_type = Mock(spec=DataDictType)
     fields = [
         TextField(name="entity_question",
                   code="EID",
                   label="What is associated entity",
                   entity_question_flag=True,
                   ddtype=dd_type),
         DateField("date", "date", "Date", "dd.mm.yyyy", dd_type)
     ]
     form_model = FormModel(dbm=Mock(spec=DatabaseManager),
                            form_code="001",
                            type="survey",
                            name="form",
                            entity_type=["clinic"],
                            fields=fields)
     form_model._doc.entity_type = ["clinic"]
     values = {'eid': 'cid005', 'date': '12.21.2012'}
     submission_doc = SurveyResponseDocument(values=values,
                                             status="success",
                                             form_model_revision="rev1")
     search_dict = {}
     form_model._doc = Mock(spec=FormModelDocument)
     form_model._doc.rev = "rev2"
     form_model._snapshots = {
         "rev1": [DateField("date", "date", "Date", "mm.dd.yyyy", dd_type)]
     }
     with patch('datawinners.search.submission_index.lookup_entity_name'
                ) as lookup_entity_name:
         lookup_entity_name.return_value = 'Test'
         search_dict = _update_with_form_model_fields(
             Mock(spec=DatabaseManager), submission_doc, search_dict,
             form_model)
         self.assertEquals("21.12.2012", search_dict.get("date"))
Exemplo n.º 4
0
    def test_should_throw_exception_when_unique_id_type_field_code_changes(
            self):
        new_fields = [
            DateField(name='q3',
                      code='q3',
                      label='Reporting date',
                      date_format='dd.mm.yyyy'),
            UniqueIdField(unique_id_type='clinic',
                          name="Q1",
                          code="EID new",
                          label="What is the clinic id?")
        ]
        latest_form_model = FormModel(self.dbm,
                                      "abc",
                                      "abc",
                                      form_code="cli001",
                                      fields=new_fields)
        es_mock = MagicMock()

        with patch(
                "datawinners.search.submission_index.get_elasticsearch_handle"
        ) as get_elasticsearch_handle_mock:
            with self.assertRaises(FieldTypeChangeException) as e:
                get_elasticsearch_handle_mock.return_value = es_mock

                SubmissionSearchStore(
                    self.dbm, latest_form_model,
                    self.form_model)._verify_unique_id_change()
Exemplo n.º 5
0
    def test_should_not_throw_exception_when_unique_id_field_reordered(self):
        new_fields = [
            UniqueIdField(unique_id_type='clinic',
                          name="Q1",
                          code="EID",
                          label="What is the clinic id?"),
            DateField(name='q3',
                      code='q3',
                      label='Reporting date',
                      date_format='dd.mm.yyyy')
        ]
        es_mock = MagicMock()
        latest_form_model = FormModel(self.dbm,
                                      "abc",
                                      "abc",
                                      form_code="cli001",
                                      fields=new_fields)

        with patch(
                "datawinners.search.submission_index.get_elasticsearch_handle"
        ) as get_elasticsearch_handle_mock:
            get_elasticsearch_handle_mock.return_value = es_mock

            SubmissionSearchStore(self.dbm, latest_form_model,
                                  self.form_model)._verify_unique_id_change()

            self.assertFalse(self.es.put_mapping.called)
Exemplo n.º 6
0
def create_questionnaire(post, dbm):
    reporting_period_dict_type = get_or_create_data_dict(
        dbm=dbm,
        name="rpd",
        slug="reporting_period",
        primitive_type="date",
        description="activity reporting period")
    entity_type = [post["entity_type"]] if is_string(
        post["entity_type"]) else post["entity_type"]
    entity_id_question = create_entity_id_question(dbm)
    activity_report_question = DateField(
        name="What is the reporting period for the activity?",
        code="rpd",
        label="Period being reported on",
        ddtype=reporting_period_dict_type,
        date_format="dd.mm.yyyy")
    fields = [entity_id_question]
    if entity_type == [REPORTER]:
        fields = [entity_id_question, activity_report_question]
    return FormModel(dbm,
                     entity_type=entity_type,
                     name=post["name"],
                     fields=fields,
                     form_code=generate_questionnaire_code(dbm),
                     type='survey',
                     state=attributes.INACTIVE_STATE)
Exemplo n.º 7
0
def _create_date_question(post_dict, ddtype):
    return DateField(name=post_dict["title"],
                     code=post_dict["code"].strip(),
                     label="default",
                     date_format=post_dict.get('date_format'),
                     ddtype=ddtype,
                     instruction=post_dict.get("instruction"))
Exemplo n.º 8
0
    def test_should_accept_submission_with_empty_fields(self):
        submission_data = u'''
        <hindimai-055>
            <name/>
            <age/>
            <dob/>
            <location/>
            <form_code>055</form_code>
        </hindimai-055>
        '''
        expected_values = {
            'name': None,
            'age': None,
            'dob': None,
            'location': None
        }
        with patch("mangrove.transport.player.parser.get_form_model_by_code"
                   ) as mock_get_form_model:
            mock_form_model = Mock()
            mock_form_model.fields = [
                TextField('', 'name', ''),
                GeoCodeField('', 'location', '', {'': ''}),
                DateField('', 'dob', '', 'mm.yyyy'),
                IntegerField('', 'age', '')
            ]
            mock_get_form_model.return_value = mock_form_model

            self.assertEquals(self.parser.parse(submission_data),
                              ('055', expected_values))
Exemplo n.º 9
0
    def test_should_convert_datetime_to_string_after_subject_import(self):
        form_model = Mock(spec=FormModel)
        date_field = DateField('name', 'code', 'Date of birth', '')
        form_model.fields = [Mock(spec=TextField), date_field]
        subjects_data = {
            u'fac8':
            OrderedDict([('q2', u'Safidy'),
                         ('q7', datetime.datetime(2010, 10, 10, 0, 0)),
                         ('q6', u'fac8')]),
            u'fac9':
            OrderedDict([('q2', u'Emission'),
                         ('q7', datetime.datetime(1947, 6, 26, 0, 0)),
                         ('q6', u'fac9')]),
            u'fac7':
            OrderedDict([('q2', u'Patrick'),
                         ('q7', datetime.datetime(2002, 3, 25, 0, 0)),
                         ('q6', u'fac7')])
        }

        formated_data = _format_imported_subjects_datetime_field_to_str(
            form_model, subjects_data)
        expected_data = [[u'Safidy', '10-10-2010', u'fac8'],
                         [u'Emission', '26-6-1947', u'fac9'],
                         [u'Patrick', '25-3-2002', u'fac7']]
        self.assertEqual(expected_data, formated_data)
Exemplo n.º 10
0
 def test_should_return_date_format(self):
     field = DateField(name="What is the date?",
                       code="dat",
                       label="naam",
                       date_format="dd/mm/yyyy")
     preview = helper.get_preview_for_field(field)
     self.assertEqual("dd/mm/yyyy", preview["constraints"])
Exemplo n.º 11
0
 def _create_date_question(self, post_dict, code):
     return DateField(name=self._get_name(post_dict),
                      code=code,
                      label=post_dict["title"],
                      date_format=post_dict.get('date_format'),
                      instruction=post_dict.get("instruction"),
                      required=post_dict.get("required"))
Exemplo n.º 12
0
 def get_report_period_field(self):
     reporting_period_question = DateField(
         name=self.report_period_question_name,
         code=self.report_period_question_name,
         label=self.report_period_question_name,
         date_format=self.datetime_format,
         event_time_field_flag=True)
     return reporting_period_question
Exemplo n.º 13
0
 def test_should_build_query_with_start_and_end_date_for_mm_yyyy_format(self):
     mock_form_model = MagicMock(spec=FormModel)
     mock_form_model.get_field_by_code.return_value = DateField(name='q1', code='q1', label='q1',
                                                                date_format='mm.yyyy')
     mock_form_model.id = 'form_id'
     actual_query = DateQuestionRangeFilter('11.2013-09.2013', mock_form_model, 'q1').build_filter_query()
     self.assertDictEqual(actual_query.to_dict(),
                          {'range': {'form_id_q1_value': {'gte': u'11.2013', 'lte': u'09.2013'}}})
Exemplo n.º 14
0
 def test_should_return_none_if_questionnaire_dose_not_contains(self):
     ddtype = Mock(spec=DataDictType)
     dateField = DateField(name="f2", code="c2", label="f2", date_format="dd.mm.yyyy", ddtype=ddtype,
                           event_time_field_flag=False)
     fields = [
         TextField(name="f1", code="c1", label="f1", ddtype=ddtype),
         dateField]
     self.assertEqual(None, get_reporting_period_field(fields))
Exemplo n.º 15
0
def get_subject_report_questions(dbm):
    entity_id_question = _create_entity_id_question(dbm, 'q1')
    reporting_period_dict_type = get_or_create_data_dict(dbm=dbm, name="rpd", slug="reporting_period",
        primitive_type="date",
        description="activity reporting period")
    activity_report_question = DateField(name=ugettext("What is the reporting period for the activity?"), code='q2',
        label="Period being reported on", ddtype=reporting_period_dict_type,
        date_format="dd.mm.yyyy", event_time_field_flag=True)
    return [entity_id_question, activity_report_question]
Exemplo n.º 16
0
 def test_should_return_date_format(self):
     type = DataDictType(Mock(DatabaseManager), name="date type")
     field = DateField(name="What is the date?",
                       code="dat",
                       label="naam",
                       ddtype=type,
                       date_format="dd/mm/yyyy")
     preview = helper.get_preview_for_field(field)
     self.assertEqual("dd/mm/yyyy", preview["constraints"])
Exemplo n.º 17
0
def get_activity_report_questions(dbm):
    activity_report_question = DateField(
        name=ugettext("What is the reporting period for the activity?"),
        code='q1',
        label="Period being reported on",
        date_format="dd.mm.yyyy",
        event_time_field_flag=True)

    return [activity_report_question]
Exemplo n.º 18
0
    def test_should_get_header_information_for_submission_excel(self):
        fields = [{
            "name": "first name",
            "code": 'q1',
            "label": 'What is your name',
            "type": "text"
        }, {
            "name": "age",
            "code": 'q2',
            "label": 'What is your age',
            "type": "integer",
            "constraints": [["range", {
                "max": "15",
                "min": "12"
            }]]
        }, {
            "name": "reporting date",
            "code": 'q3',
            "label": 'What is the reporting date',
            "date_format": "dd.mm.yyyy",
            "type": "date"
        }, {
            "name": "choices",
            "code": 'q5',
            "label": 'Your choices',
            "type": "select"
        }]
        form_model_fields = [
            TextField("first_name", "q1", "What is your name"),
            IntegerField("age", "q2", "What is your age"),
            DateField("reporting date", "q3", "What is the reporting date",
                      "dd.mm.yyyy")
        ]
        form_model = FormModel(Mock(spec=DatabaseManager),
                               name="some_name",
                               form_code="cli00_mp",
                               fields=form_model_fields)

        headers = get_submission_headers(fields, form_model)

        headers_text = self._get_header_component(headers, 0)
        self.assertEqual([
            "What is your name", "What is your age",
            "What is the reporting date", "Your choices"
        ], headers_text)

        header_instructions = self._get_header_component(headers, 1)
        self.assertEqual([
            "\n\nAnswer must be a word", "\n\nEnter a number between 12-15.",
            "\n\nAnswer must be a date in the following format: day.month.year",
            "\n\nEnter 1 or more answers from the list."
        ], header_instructions)

        header_examples = self._get_header_component(headers, 2)
        self.assertEqual([
            "\n\n", "\n\n", "\n\nExample: 25.12.2011", "\n\nExample: a or ab"
        ], header_examples)
Exemplo n.º 19
0
 def _create_date_question(self, post_dict, code):
     return DateField(name=self._get_name(post_dict, code), code=code, label=post_dict["title"],
                      date_format=post_dict.get('date_format'),
                      instruction=post_dict.get("instruction"),
                      required=post_dict.get("required"), parent_field_code=post_dict.get('parent_field_code'),
                      hint=post_dict.get('hint'), constraint_message=post_dict.get('constraint_message'),
                      appearance=post_dict.get('appearance'),
                      default=post_dict.get('default'),
                      xform_constraint=post_dict.get('xform_constraint'),
                      relevant=post_dict.get('relevant'))
    def test_format_is_present_for_date_fields(self):
        value_mock = PropertyMock(return_value={'q3': '21.03.2011'})
        type(self.survey_response).values = value_mock

        builder = EnrichedSurveyResponseBuilder(None, self.survey_response, self.form_model, {})
        dictionary = builder._create_answer_dictionary(DateField('name', 'q3', 'date lab', 'dd.mm.yyyy'))
        self.assertEquals('dd.mm.yyyy', dictionary.get('format'))
        self.assertEquals('21.03.2011', dictionary.get('answer'))
        self.assertEquals('date lab', dictionary.get('label'))
        self.assertEquals('date', dictionary.get('type'))
Exemplo n.º 21
0
    def test_should_return_error_for_incorrect_date_format_error_for_wrong_format(
            self):
        with self.assertRaises(IncorrectDate) as e:
            field = DateField(name="Age",
                              code="Q2",
                              label="What is your birth date",
                              language="eng",
                              date_format="mm.yyyy",
                              ddtype=self.ddtype)
            valid_value = field.validate("13.2010")
            self.assertFalse(valid_value)
        self.assertEqual(
            e.exception.message,
            "Answer 13.2010 for question Q2 is invalid. Expected date in mm.yyyy format"
        )

        with self.assertRaises(IncorrectDate) as e:
            field = DateField(name="Age",
                              code="Q2",
                              label="What is your birth date",
                              language="eng",
                              date_format="dd.mm.yyyy",
                              ddtype=self.ddtype)
            valid_value = field.validate("33.12.2010")
            self.assertFalse(valid_value)
        self.assertEqual(
            e.exception.message,
            "Answer 33.12.2010 for question Q2 is invalid. Expected date in dd.mm.yyyy format"
        )

        with self.assertRaises(IncorrectDate) as e:
            field = DateField(name="Age",
                              code="Q2",
                              label="What is your birth date",
                              language="eng",
                              date_format="mm.dd.yyyy",
                              ddtype=self.ddtype)
            valid_value = field.validate("13.01.2010")
            self.assertFalse(valid_value)
        self.assertEqual(
            e.exception.message,
            "Answer 13.01.2010 for question Q2 is invalid. Expected date in mm.dd.yyyy format"
        )
Exemplo n.º 22
0
 def setUp(self):
     self.dbm = Mock(spec=DatabaseManager)
     fields = [DateField(name='q3', code='q3', label='Reporting date', date_format='dd.mm.yyyy'),
          UniqueIdField(unique_id_type='clinic',name="Q1", code="EID", label="What is the clinic id?")]
     self.form_model = FormModel(self.dbm, "abc", "abc", form_code="cli001", fields=fields)
     self.dbm = MagicMock(spec=DatabaseManager)
     dbm_view = MagicMock()
     self.dbm.database_name = 'somedb'
     self.dbm.view = dbm_view
     self.es = Mock()
Exemplo n.º 23
0
    def test_should_call_query_match_for_current_day(self):
        mock_form_model = MagicMock(spec=FormModel)
        mock_form_model.get_field_by_code.return_value = DateField(name='q1', code='q1', label='q1',
                                                                   date_format='dd.mm.yyyy')
        mock_form_model.id = 'form_id'
        today = "26.11.2013"

        actual_query = DateQuestionRangeFilter(today, mock_form_model, 'q1').build_filter_query()

        self.assertDictEqual(actual_query.to_dict(),
                             {'range': {'form_id_q1_value': {'gte': u'26.11.2013', 'lte': u'26.11.2013'}}})
Exemplo n.º 24
0
 def test_should_call_query_match_for_current_day(self):
     mock_query = Mock(spec=elasticutils.S)
     mock_form_model = MagicMock(spec=FormModel)
     mock_form_model.get_field_by_code.return_value = DateField(
         name='q1', code='q1', label='q1', date_format='dd.mm.yyyy')
     mock_form_model.id = 'form_id'
     today = "26.11.2013"
     DateQuestionRangeFilter(today, mock_form_model,
                             'q1').build_filter_query(mock_query)
     mock_query.filter.assert_called_with(
         form_id_q1_value__range=['26.11.2013', '26.11.2013'])
Exemplo n.º 25
0
 def test_should_build_query_with_start_and_end_date_for_mm_yyyy_format(
         self):
     mock_query = Mock(spec=elasticutils.S)
     mock_form_model = MagicMock(spec=FormModel)
     mock_form_model.get_field_by_code.return_value = DateField(
         name='q1', code='q1', label='q1', date_format='mm.yyyy')
     mock_form_model.id = 'form_id'
     DateQuestionRangeFilter('11.2013-09.2013', mock_form_model,
                             'q1').build_filter_query(mock_query)
     mock_query.filter.assert_called_with(
         form_id_q1_value__range=['11.2013', '09.2013'])
Exemplo n.º 26
0
 def _create_date_question(self, post_dict, ddtype, code):
     return DateField(
         name=self._get_name(post_dict),
         code=code,
         label=post_dict["title"],
         date_format=post_dict.get('date_format'),
         ddtype=ddtype,
         instruction=post_dict.get("instruction"),
         required=post_dict.get("required"),
         event_time_field_flag=post_dict.get('event_time_field_flag',
                                             False),
     )
Exemplo n.º 27
0
    def test_should_should_get_fields_values_after_question_count_changed(
            self):
        eid_field = TextField(label="What is associated entity?",
                              code="EID",
                              name="What is associatéd entity?",
                              entity_question_flag=True,
                              ddtype=self.ddtype)
        rp_field = DateField(label="Report date",
                             code="RD",
                             name="What is réporting date?",
                             date_format="dd.mm.yyyy",
                             event_time_field_flag=True,
                             ddtype=self.ddtype)
        symptoms_field = TextField(label="Zhat are symptoms?",
                                   code="SY",
                                   name="Zhat are symptoms?",
                                   ddtype=self.ddtype)
        gps = TextField(label="What is your blood group?",
                        code="GPS",
                        name="What is your gps?",
                        ddtype=self.ddtype)
        form_model = FormModelBuilder(self.manager, ['clinic'],
                                      form_code='cli001').add_fields(
                                          eid_field, rp_field, symptoms_field,
                                          gps).build()

        self.submit_data({
            'form_code': 'cli001',
            'EID': 'cid001',
            'RD': '12.12.2012',
            'SY': 'Fever',
            'GPS': 'NewYork'
        })

        form_model.create_snapshot()
        form_model.delete_field("SY")
        form_model.save()

        self.submit_data({
            'form_code': 'cli001',
            'EID': 'cid001',
            'RD': '12.12.2012',
            'GPS': '1,1'
        })

        submissions = successful_submissions(self.manager,
                                             form_model.form_code)
        analyzer = SubmissionAnalyzer(form_model, self.manager, self.org_id,
                                      submissions)
        values = analyzer.get_raw_values()

        self.assertEqual(['1,1'], values[0][5:])
        self.assertEqual(['NewYork'], values[1][5:])
    def test_convert_survey_response_values_to_dict_format(self):
        survey_response_doc = SurveyResponseDocument(
            values={
                'q1': '23',
                'q2': 'sometext',
                'q3': 'a',
                'geo': '2.34,5.64',
                'date': '12.12.2012'
            })
        survey_response = SurveyResponse(Mock())
        survey_response._doc = survey_response_doc
        int_field = IntegerField(name='question one',
                                 code='q1',
                                 label='question one',
                                 ddtype=Mock(spec=DataDictType))
        text_field = TextField(name='question two',
                               code='q2',
                               label='question two',
                               ddtype=Mock(spec=DataDictType))
        single_choice_field = SelectField(name='question three',
                                          code='q3',
                                          label='question three',
                                          options=[("one", "a"), ("two", "b"),
                                                   ("three", "c"),
                                                   ("four", "d")],
                                          single_select_flag=True,
                                          ddtype=Mock(spec=DataDictType))
        geo_field = GeoCodeField(name='geo',
                                 code='GEO',
                                 label='geo',
                                 ddtype=Mock())
        date_field = DateField(name='date',
                               code='DATE',
                               label='date',
                               date_format='dd.mm.yyyy',
                               ddtype=Mock())
        questionnaire_form_model = Mock(spec=FormModel)
        questionnaire_form_model.form_code = 'test_form_code'
        questionnaire_form_model.fields = [
            int_field, text_field, single_choice_field, geo_field, date_field
        ]

        request_dict = construct_request_dict(survey_response,
                                              questionnaire_form_model)
        expected_dict = OrderedDict({
            'q1': '23',
            'q2': 'sometext',
            'q3': 'a',
            'GEO': '2.34,5.64',
            'DATE': '12.12.2012',
            'form_code': 'test_form_code'
        })
        self.assertEqual(expected_dict, request_dict)
Exemplo n.º 29
0
 def test_date_field_with_event_time_flag_should_return_expected_json(self):
     field = DateField('event_time', 'et', 'event_time', '%m.%d.%Y')
     expected_json = {
         "instruction": None,
         "label": "event_time",
         "name": "event_time",
         "code": "et",
         'parent_field_code': None,
         "type": "date",
         "date_format": "%m.%d.%Y",
         "required": True,
     }
     self.assertEqual(expected_json, field._to_json())
Exemplo n.º 30
0
 def test_should_create_type_list(self):
     ddtype = Mock(spec=DataDictType)
     question1 = IntegerField(label="number_question", code="ID", name="How many beds",
                              language="eng", ddtype=ddtype)
     question2 = TextField(label="question1_Name", code="Q1", name="What is your name",
                           defaultValue="some default value", language="eng", ddtype=ddtype)
     question3 = SelectField(label="multiple_choice_question", code="Q2",
                             options=[("red", 1), ("yellow", 2), ('green', 3)], name="What is your favourite colour",
                             ddtype=ddtype)
     question4 = DateField("What is date", "Q4", "date_question", "mm.yyyy", ddtype)
     actual_list = helper.get_type_list([question1, question2, question3, question4])
     choice_type = copy(helper.MULTI_CHOICE_TYPE_OPTIONS)
     expected_list = [helper.NUMBER_TYPE_OPTIONS, helper.TEXT_TYPE_OPTIONS, choice_type, helper.DATE_TYPE_OPTIONS]
     self.assertListEqual(expected_list, actual_list)