コード例 #1
0
 def test_catalogers(self):
     # listing
     catalogers = api.list_catalogers()
     self.assertEqual(len(catalogers), 1)
     self.assertEqual(catalogers, {CATALOGER_ID: METADATA})
     # by id
     cataloger = api.get_cataloger_by_id(CATALOGER_ID)
     self.assertFalse(cataloger is None)
     self.assertTrue(isinstance(cataloger[0], MockCataloger))
     self.assertRaises(PluginNotFound, api.get_cataloger_by_id, 'not-valid')
     # is_valid
     self.assertTrue(api.is_valid_cataloger(CATALOGER_ID))
     self.assertFalse(api.is_valid_cataloger('not-valid'))
コード例 #2
0
    def catalogers(self):
        """
        Returns the names and versions of all catalogers loaded in the server.
        If no catalogers are found, an empty list is returned.

        :return: list of tuples indicating catalogers name and version
        :rtype:  list of tuples (str, list of int)
        """

        cataloger_dicts = plugin_api.list_catalogers()
        result = []
        for d in cataloger_dicts:
            merged = cataloger_dicts[d]
            merged['id'] = d
            result.append(merged)
        return result
コード例 #3
0
ファイル: plugin.py プロジェクト: AndreaGiardini/pulp
    def catalogers(self):
        """
        Returns the names and versions of all catalogers loaded in the server.
        If no catalogers are found, an empty list is returned.

        :return: list of tuples indicating catalogers name and version
        :rtype:  list of tuples (str, list of int)
        """

        cataloger_dicts = plugin_api.list_catalogers()
        result = []
        for d in cataloger_dicts:
            merged = cataloger_dicts[d]
            merged['id'] = d
            result.append(merged)
        return result