from django.test import SimpleTestCase

from corehq.apps.export.models import (
    ExportItem,
    ExportColumn,
)


class TestExportItemGeneration(SimpleTestCase):

    def setUp(self):
        self.item = ExportItem(
            path=['data', 'question1'],
            label='Question One',
            last_occurrence=3,
        )

    def test_create_default_from_export_item(self):
        column = ExportColumn.create_default_from_export_item([None], self.item, 3)

        self.assertEqual(column.show, True)
        self.assertEqual(column.label, 'Question One')
        self.assertEqual(column.selected, True)

    def test_create_default_from_export_item_deleted(self):
        column = ExportColumn.create_default_from_export_item([None], self.item, 4)

        self.assertEqual(column.show, False)
        self.assertEqual(column.label, 'Question One')
        self.assertEqual(column.selected, False)

    def test_create_default_from_export_item_not_main_table(self):
        column = ExportColumn.create_default_from_export_item(['other_table'], self.item, 3)

        self.assertEqual(column.show, True)
        self.assertEqual(column.label, 'Question One')
        self.assertEqual(column.selected, False)

@@ -158,16 +158,36 @@
 stCase):
+%0A    app_id = '1234'
 %0A%0A    de
@@ -338,10 +338,26 @@
 ence
-=3
+s=%7Bself.app_id: 3%7D
 ,%0A  
@@ -490,33 +490,48 @@
 ne%5D, self.item, 
-3
+%7Bself.app_id: 3%7D
 )%0A%0A        self.
@@ -806,17 +806,32 @@
 f.item, 
-4
+%7Bself.app_id: 4%7D
 )%0A%0A     
@@ -1132,17 +1132,32 @@
 f.item, 
-3
+%7Bself.app_id: 3%7D
 )%0A%0A     

Fix create_default_from_export_item tests