import os.path

from django.test import TestCase

from import_export.core import Importer

from .models import Book


class BookImporter(Importer):

    model = Book


class ImporterTest(TestCase):

    def setUp(self):
        self.filename = os.path.join(os.path.dirname(__file__), 'exports',
                'books.csv')

    def test_import_create(self):
        result = BookImporter(open(self.filename), dry_run=False).run()
        self.assertFalse(result.has_errors())
        self.assertEqual(Book.objects.count(), 1)

    def test_import_update(self):
        Book.objects.create(id=1, name="Other book")
        result = BookImporter(open(self.filename), dry_run=False).run()
        self.assertFalse(result.has_errors())
        self.assertEqual(Book.objects.count(), 1)
        self.assertEqual(Book.objects.all()[0].name, "Some book")
        self.assertNotEqual(result[0].orig_fields[1], result[0].fields[1])

@@ -872,24 +872,29 @@
 Equal(result
+.rows
 %5B0%5D.orig_fie
@@ -900,23 +900,56 @@
 elds%5B1%5D,
+%0A                           
  result
+.rows
 %5B0%5D.fiel

FIX tests to reflect changes in 582f6a49425c4b8ff8e8fc857b5e8c740180855d