# Path: promises_instances/models.py
# class DDAHInstance(Instance):
#     pass
# 
# Path: promises_instances/csv_loader.py
# class DDAHCSVProcessor(CsvProcessor):
#     def __init__(self, file_, instance, **kwargs):
#         self.instance = instance
#         cat_qs = DDAHCategory.objects.filter(instance=self.instance)
#         promise_qs = DDAHPromise.objects.filter(instance=self.instance)
#         kwargs['category_qs'] = cat_qs
#         kwargs['promise_qs'] = promise_qs
#         kwargs['instance'] = self.instance
#         super(DDAHCSVProcessor, self).__init__(file_, **kwargs)


from django.test import TestCase
from promises_instances.models import DDAHInstance
from promises_instances.csv_loader import DDAHCSVProcessor
from django.core.management import call_command
import os
import codecs
# -*- coding: utf-8 -*-


class CSVCommandTestCase(TestCase):
    def setUp(self):
        super(CSVCommandTestCase, self).setUp()
        current_dir = os.path.dirname(os.path.realpath(__file__))
        self.csv_file = os.path.join(current_dir, 'fixtures', 'example_data.csv')
        self.instance = DDAHInstance.objects.create(label='label', title='the title')

    def test_command_itself(self):
        file_ = codecs.open(self.csv_file)

# Path: promises_instances/models.py
# class DDAHInstance(Instance):
#     pass
# 
# Path: promises_instances/csv_loader.py
# class DDAHCSVProcessor(CsvProcessor):
#     def __init__(self, file_, instance, **kwargs):
#         self.instance = instance
#         cat_qs = DDAHCategory.objects.filter(instance=self.instance)
#         promise_qs = DDAHPromise.objects.filter(instance=self.instance)
#         kwargs['category_qs'] = cat_qs
#         kwargs['promise_qs'] = promise_qs
#         kwargs['instance'] = self.instance
#         super(DDAHCSVProcessor, self).__init__(file_, **kwargs)


# Path: promises_instances/tests/csv_importer_tests.py
from django.test import TestCase
from promises_instances.models import DDAHInstance
from promises_instances.csv_loader import DDAHCSVProcessor
from django.core.management import call_command
import os
import codecs

# -*- coding: utf-8 -*-


class CSVCommandTestCase(TestCase):
    def setUp(self):
        super(CSVCommandTestCase, self).setUp()
        current_dir = os.path.dirname(os.path.realpath(__file__))
        self.csv_file = os.path.join(current_dir, 'fixtures', 'example_data.csv')
        self.instance = DDAHInstance.objects.create(label='label', title='the title')

    def test_command_itself(self):
        file_ = codecs.open(self.csv_file)

        processor = DDAHCSVProcessor(file_, self.instance)