def test_csv_with_excel_content_type(self):
        """
        Often on Windows a csv file comes with an excel content-type (e.g: 'application/vnd.ms-excel')
        Test that we handle the case.
        """
        view = InferDatasetView.as_view()
        columns = ['Name', 'Age', 'Weight', 'Comments']
        rows = [
            columns, ['Frederic', '56', '80.5', 'a comment'],
            ['Hilda', '24', '56', '']
        ]
        file_ = helpers.rows_to_csv_file(rows)
        factory = APIRequestFactory()
        with open(file_, 'rb') as fp:
            payload = {
                'file': fp,
            }
            # In order to hack the Content-Type of the multipart form data we need to use the APIRequestFactory and work
            # with the view directly. Can't use the classic API client.
            # hack the content-type of the request.
            data, content_type = factory._encode_data(payload,
                                                      format='multipart')
            if six.PY3:
                data = data.decode('utf-8')
            data = data.replace('Content-Type: text/csv',
                                'Content-Type: application/vnd.ms-excel')
            if six.PY3:
                data = data.encode('utf-8')
            request = factory.generic('POST',
                                      self.url,
                                      data,
                                      content_type=content_type)
            user = self.data_engineer_1_user
            token, _ = Token.objects.get_or_create(user=user)
            force_authenticate(request,
                               user=self.data_engineer_1_user,
                               token=token)
            resp = view(request).render()
            self.assertEqual(status.HTTP_200_OK, resp.status_code)
            # should be json
            self.assertEqual(resp.get('content-type'), 'application/json')
            if six.PY3:
                content = resp.content.decode('utf-8')
            else:
                content = resp.content
            received = json.loads(content)

            # name should be set with the file name
            self.assertIn('name', received)
            file_name = path.splitext(path.basename(fp.name))[0]
            self.assertEqual(file_name, received.get('name'))
            # type should be 'generic'
            self.assertIn('type', received)
            self.assertEqual('generic', received.get('type'))

            # data_package verification
            self.assertIn('data_package', received)
            self.verify_inferred_data(received)

            # verify schema
            schema_descriptor = Package(
                received.get('data_package')).resources[0].descriptor['schema']
            schema = utils_data_package.GenericSchema(schema_descriptor)
            self.assertEqual(len(schema.fields), len(columns))
            self.assertEqual(schema.field_names, columns)

            field = schema.get_field_by_name('Name')
            self.assertEqual(field.type, 'string')
            self.assertFalse(field.required)
            self.assertEqual(field.format, 'default')

            field = schema.get_field_by_name('Age')
            self.assertEqual(field.type, 'integer')
            self.assertFalse(field.required)
            self.assertEqual(field.format, 'default')

            field = schema.get_field_by_name('Weight')
            self.assertEqual(field.type, 'number')
            self.assertFalse(field.required)
            self.assertEqual(field.format, 'default')

            field = schema.get_field_by_name('Comments')
            self.assertEqual(field.type, 'string')
            self.assertFalse(field.required)
            self.assertEqual(field.format, 'default')