import unittest
from signals.generators.ios.core_data import get_current_version, get_core_data_from_folder


class CoreDataTestCase(unittest.TestCase):
    def test_get_current_version(self):
        version_name = get_current_version('./tests/files/doubledummy.xcdatamodeld')
        self.assertEqual(version_name, 'dummy 2.xcdatamodel')
        version_name = get_current_version('./tests/files/dummy.xcdatamodeld')
        self.assertEqual(version_name, 'dummy.xcdatamodel')

    def test_get_core_data_from_folder(self):
        xcdatamodeld_path = './tests/files/doubledummy.xcdatamodeld'
        contents_path = xcdatamodeld_path + '/dummy 2.xcdatamodel/contents'
        self.assertEqual(get_core_data_from_folder(xcdatamodeld_path), contents_path)

        xcdatamodeld_path = './tests/files/dummy.xcdatamodeld'
        contents_path = xcdatamodeld_path + '/dummy.xcdatamodel/contents'
        self.assertEqual(get_core_data_from_folder(xcdatamodeld_path), contents_path)

[((7, 23, 7, 84), 'signals.generators.ios.core_data.get_current_version', 'get_current_version', ({(7, 43, 7, 83): '"""./tests/files/doubledummy.xcdatamodeld"""'}, {}), "('./tests/files/doubledummy.xcdatamodeld')", False, 'from signals.generators.ios.core_data import get_current_version, get_core_data_from_folder\n'), ((9, 23, 9, 78), 'signals.generators.ios.core_data.get_current_version', 'get_current_version', ({(9, 43, 9, 77): '"""./tests/files/dummy.xcdatamodeld"""'}, {}), "('./tests/files/dummy.xcdatamodeld')", False, 'from signals.generators.ios.core_data import get_current_version, get_core_data_from_folder\n'), ((15, 25, 15, 69), 'signals.generators.ios.core_data.get_core_data_from_folder', 'get_core_data_from_folder', ({(15, 51, 15, 68): 'xcdatamodeld_path'}, {}), '(xcdatamodeld_path)', False, 'from signals.generators.ios.core_data import get_current_version, get_core_data_from_folder\n'), ((19, 25, 19, 69), 'signals.generators.ios.core_data.get_core_data_from_folder', 'get_core_data_from_folder', ({(19, 51, 19, 68): 'xcdatamodeld_path'}, {}), '(xcdatamodeld_path)', False, 'from signals.generators.ios.core_data import get_current_version, get_core_data_from_folder\n')]