Exemple #1
0
    def load_resources(self, package_name, data_source=None):
        """
        Runs the setup.py file found in the package root

        """
        # data_source = None if data_source == '' else data_source
        # load = import_string('%s.setup.load_resources' % package_name)
        # load(data_source)
        ArchesFileImporter(data_source).import_business_data()
Exemple #2
0
    def import_json(self, data_source='', graphs=None, resources=None):
        """
        Imports objects from arches.json.

        """

        if data_source == '':
            data_source = settings.RESOURCE_GRAPH_LOCATIONS

        if isinstance(data_source, basestring):
            data_source = [data_source]

        for path in data_source:
            if os.path.isfile(os.path.join(path)):
                ArchesFileImporter(path).import_all()
            else:
                file_paths = [file_path for file_path in os.listdir(path) if file_path.endswith('.json')]
                for file_path in file_paths:
                    ArchesFileImporter(os.path.join(path, file_path)).import_all()
	def test_1_1_n_n(self):
		og_tile_count = TileModel.objects.count()
		ArchesFileImporter('tests/fixtures/data/json/cardinality_test_data/source.json','tests/fixtures/data/json/cardinality_test_data/1_1_n_n.mapping').import_all()
		new_tile_count = TileModel.objects.count()
		tile_difference = new_tile_count - og_tile_count
		self.assertEqual(tile_difference, 2)
	def setUp(self):
		ResourceInstance.objects.all().delete()
		ArchesFileImporter(os.path.join('tests/fixtures/data/json/cardinality_test_data/target.json')).import_all()