Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
valdergallo committed Feb 11, 2015
1 parent 14654cd commit fc0ceb9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions data_importer/tests/test_generic_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,26 @@ def test_import_with_model_instance(self):
class CustomerDataImporter(GenericImporter):
class Meta:
model = Invoice
ignore_first_line = True


class TestGenericImporterXLSXSetup(TestCase):
class TestGenericImporterBehavior(TestCase):

def setUp(self):
self.xls_file = os.path.join(LOCAL_DIR, 'data/test_invalid_lines.xlsx')

def test_save_lines_without_errors(self):
def test_xlsx_is_not_valid(self):
instance = CustomerDataImporter(source=self.xls_file)
self.assertFalse(instance.is_valid())

def test_save_lines_without_errors(self):
instance = CustomerDataImporter(source=self.xls_file)
instance.save()
count_invoices = Invoice.objects.count()

count_invoices = Invoice.objects.count()
self.assertEqual(count_invoices, 6, ('error', count_invoices))

def test_get_three_errors(self):
instance = CustomerDataImporter(source=self.xls_file)
instance.is_valid()
self.assertEqual(len(instance.errors), 3)

0 comments on commit fc0ceb9

Please sign in to comment.