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)

[((216, 277), 'signals.generators.ios.core_data.get_current_version', 'get_current_version', (['"""./tests/files/doubledummy.xcdatamodeld"""'], {}), "('./tests/files/doubledummy.xcdatamodeld')\n", (235, 277), False, 'from signals.generators.ios.core_data import get_current_version, get_core_data_from_folder\n'), ((363, 418), 'signals.generators.ios.core_data.get_current_version', 'get_current_version', (['"""./tests/files/dummy.xcdatamodeld"""'], {}), "('./tests/files/dummy.xcdatamodeld')\n", (382, 418), False, 'from signals.generators.ios.core_data import get_current_version, get_core_data_from_folder\n'), ((696, 740), 'signals.generators.ios.core_data.get_core_data_from_folder', 'get_core_data_from_folder', (['xcdatamodeld_path'], {}), '(xcdatamodeld_path)\n', (721, 740), False, 'from signals.generators.ios.core_data import get_current_version, get_core_data_from_folder\n'), ((920, 964), 'signals.generators.ios.core_data.get_core_data_from_folder', 'get_core_data_from_folder', (['xcdatamodeld_path'], {}), '(xcdatamodeld_path)\n', (945, 964), False, 'from signals.generators.ios.core_data import get_current_version, get_core_data_from_folder\n')]