Esempio n. 1
0
 def test_importers(self):
     # listing
     importers = api.list_importers()
     self.assertEqual(len(importers), 1)
     self.assertEqual(importers, {IMPORTER_ID: METADATA})
     # list types
     self.assertEqual(api.list_importer_types(IMPORTER_ID), METADATA)
     # by id
     importer = api.get_importer_by_id(IMPORTER_ID)
     self.assertFalse(importer is None)
     self.assertTrue(isinstance(importer[0], MockImporter))
     self.assertRaises(PluginNotFound, api.get_importer_by_id, 'not-valid')
     # is_valid
     self.assertTrue(api.is_valid_importer(IMPORTER_ID))
     self.assertFalse(api.is_valid_importer('not-valid'))
Esempio n. 2
0
    def importers(self):
        """
        Returns the names and versions of all importers loaded in the server.
        If no importers are found, an empty list is returned.

        @return: list of dicts containing metadata about the importer
        @rtype:  list
        """

        importer_dicts = plugin_api.list_importers()
        result = []
        for i in importer_dicts:
            merged = importer_dicts[i]
            merged['id'] = i
            result.append(merged)
        return result
Esempio n. 3
0
    def importers(self):
        """
        Returns the names and versions of all importers loaded in the server.
        If no importers are found, an empty list is returned.

        :return: list of dicts containing metadata about the importer
        :rtype:  list
        """

        importer_dicts = plugin_api.list_importers()
        result = []
        for i in importer_dicts:
            merged = importer_dicts[i]
            merged['id'] = i
            result.append(merged)
        return result