Beispiel #1
0
    def test_add_extra_header_fields_hint(self):
        """header['fieldhint'] should be equal to the field's excel hint."""

        inputfield = InputFieldF(excel_hint='test 123')
        fieldinfo = eie.FieldInfo([])

        header = fieldinfo.add_extra_header_fields({'inputfield': inputfield})

        self.assertEquals(header['fieldhint'], 'test 123')
Beispiel #2
0
    def test_add_extra_header_fields_name(self):
        """header['fieldname'] should be equal to the field's name."""

        inputfield = InputFieldF(name='test 123')
        fieldinfo = eie.FieldInfo([])

        header = fieldinfo.add_extra_header_fields({'inputfield': inputfield})

        self.assertEquals(header['fieldname'], 'test 123')
Beispiel #3
0
    def test_add_extra_header_fields_type_date(self):
        """header['fieldtype'] should be equal to a specific string in
        case the inputfield's type is TYPE_DATE."""

        inputfield = InputFieldF(type=InputField.TYPE_DATE,
                                 destination_table='Scenario')
        fieldinfo = eie.FieldInfo([])

        header = fieldinfo.add_extra_header_fields({'inputfield': inputfield})

        self.assertEquals(header['fieldtype'], u'Datum (DD/MM/JJJJ)')
Beispiel #4
0
    def test_add_extra_header_fields_type_ignored(self):
        """If an inputfield is ignored, we place a notice in the type field"""

        inputfield = InputFieldF(type=InputField.TYPE_DATE,
                                 destination_table='Project')
        fieldinfo = eie.FieldInfo([])

        header = fieldinfo.add_extra_header_fields({'inputfield': inputfield})

        # Field type contains a text within ( )
        self.assertTrue(header['fieldtype'].startswith('(')
                        and header['fieldtype'].endswith(')'))
Beispiel #5
0
    def test_add_extra_header_fields_type(self):
        """header['fieldtype'] should be equal to the translated version
        of the choice's description."""

        activate('nl')

        inputfield = InputFieldF(type=InputField.TYPE_STRING,
                                 destination_table='Scenario')
        fieldinfo = eie.FieldInfo([])

        header = fieldinfo.add_extra_header_fields({'inputfield': inputfield})

        self.assertEquals(header['fieldtype'], u'Tekst')

        deactivate()
Beispiel #6
0
    def test_date_inputfield_has_number_format(self, mocked_make_style):
        inputfield = InputFieldF(type=InputField.TYPE_DATE)
        eie.Cell(40725.0, inputfield=inputfield)

        num_format = mocked_make_style.call_args[0][1]
        self.assertEquals(num_format, 'dd/mm/yyyy')