def testCreateGeojsonDataset(self):

        # Create the dataset folder.

        path = '/minerva_dataset/folder'
        params = {
            'userId': self._user['_id'],
        }
        response = self.request(path=path, method='POST', params=params, user=self._user)
        self.assertStatusOk(response)
        datasetFolder = response.json['folder']
        datasetParentId = datasetFolder['parentId']

        # Create an item in the dataset parent folder.

        params = {
            'name': 'misplaced_item',
            'folderId': datasetParentId
        }
        response = self.request(path='/item', method='POST', params=params, user=self._user)
        self.assertStatusOk(response)
        misplacedItemId = response.json['_id']

        # Attempt to create a geojson dataset in the wrong folder.

        path = '/minerva_dataset_geojson'
        params = {
            'itemId': misplacedItemId
        }
        response = self.request(path=path, method='POST', params=params, user=self._user)
        self.assertStatus(response, 400)



        # Helper function to create an item and upload a file on disk.

        def createItemFromFile(datasetFolderId, itemName, itemFile):
            # create the item
            params = {
                'name': itemName,
                'folderId': datasetFolderId
            }
            response = self.request(path='/item', method='POST', params=params, user=self._user)
            self.assertStatusOk(response)
            itemId = response.json['_id']

            filename = itemFile['name']
            filepath = itemFile['path']
            mimeType = itemFile['mimeType']
            sizeBytes = os.stat(filepath).st_size

            # create the file
            response = self.request(
                path='/file',
                method='POST',
                user=self._user,
                params={
                    'parentType': 'item',
                    'parentId': itemId,
                    'name': filename,
                    'size': sizeBytes,
                    'mimeType': mimeType
                }
            )
            self.assertStatusOk(response)
            uploadId = response.json['_id']

            # upload the file contents
            with open(filepath, 'rb') as file:
                filedata = file.read()

            response = self.multipartRequest(
                path='/file/chunk',
                user=self._user,
                fields=[('offset', 0), ('uploadId', uploadId)],
                files=[('chunk', filename, filedata)]
            )
            self.assertStatusOk(response)

            return itemId


        # Create an item in the dataset folder without a json or geojson ext.

        pluginTestDir = os.path.dirname(os.path.realpath(__file__))

        csvFile = {
            'name': 'points.csv',
            'path': os.path.join(pluginTestDir, 'data', 'points.csv'),
            'mimeType': 'application/csv'
        }
        csvItemId = createItemFromFile(datasetFolder['_id'], 'csvItem', csvFile)

        path = '/minerva_dataset_geojson'
        params = {
            'itemId': csvItemId
        }
        response = self.request(path=path, method='POST', params=params, user=self._user)
        self.assertStatus(response, 400)

        # Create a geojson dataset from a json file item.

        jsonFile = {
            'name': 'twopoints.json',
            'path': os.path.join(pluginTestDir, 'data', 'twopoints.json'),
            'mimeType': 'application/json'
        }
        jsonItemId = createItemFromFile(datasetFolder['_id'], 'jsonItem', jsonFile)

        path = '/minerva_dataset_geojson'
        params = {
            'itemId': jsonItemId
        }
        response = self.request(path=path, method='POST', params=params, user=self._user)
        self.assertStatusOk(response)
        # Ensure this is an item and not just minerva metadata.
        self.assertHasKeys(response.json, ['baseParentType'])
        # Ensure the minerva metadata is correct.
        self.assertHasKeys(response.json['meta']['minerva'], ['geojson_file', 'dataset_type', 'original_type', 'original_files'])
        self.assertEquals(response.json['meta']['minerva']['dataset_type'], 'geojson')
        self.assertEquals(response.json['meta']['minerva']['original_type'], 'geojson')

        # Create a geojson dataset from a geojson file item.

        geojsonFile = {
            'name': 'states.geojson',
            'path': os.path.join(pluginTestDir, 'data', 'states.geojson'),
            'mimeType': 'application/vnd.geo+json'
        }
        geojsonItemId = createItemFromFile(datasetFolder['_id'], 'geojsonItem', geojsonFile)

        path = '/minerva_dataset_geojson'
        params = {
            'itemId': geojsonItemId
        }
        response = self.request(path=path, method='POST', params=params, user=self._user)
        self.assertStatusOk(response)
        # Ensure this is an item and not just minerva metadata.
        self.assertHasKeys(response.json, ['baseParentType'])
        # Ensure the minerva metadata is correct.
        self.assertHasKeys(response.json['meta']['minerva'], ['geojson_file', 'dataset_type', 'original_type', 'original_files'])
        self.assertEquals(response.json['meta']['minerva']['dataset_type'], 'geojson')
        self.assertEquals(response.json['meta']['minerva']['original_type'], 'geojson')
Unique id in URN form, distinguishing each unique build.
dataset/ETHPy150Open Kitware/minerva/plugin_tests/geojson_test.py/GeojsonTestCase.testCreateGeojsonDataset--crossover with--dataset/ETHPy150Open rsms/smisk/setup.py/core_build_id