Beispiel #1
0
 def test_distributors(self):
     # listing
     distributors = api.list_distributors()
     self.assertEqual(len(distributors), 1)
     self.assertEqual(distributors, {DISTRIBUTOR_ID: METADATA})
     # list types
     self.assertEqual(api.list_distributor_types(DISTRIBUTOR_ID), METADATA)
     # by id
     distributor = api.get_distributor_by_id(DISTRIBUTOR_ID)
     self.assertFalse(distributor is None)
     self.assertTrue(isinstance(distributor[0], MockDistributor))
     self.assertRaises(PluginNotFound, api.get_distributor_by_id, 'not-valid')
     # is_valid
     self.assertTrue(api.is_valid_distributor(DISTRIBUTOR_ID))
     self.assertFalse(api.is_valid_distributor('not-valid'))
Beispiel #2
0
    def distributors(self):
        """
        Returns the names and versions of all distributors loaded in the server.
        If no distributors are found, an empty list is returned.

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

        distributor_dicts = plugin_api.list_distributors()
        result = []
        for d in distributor_dicts:
            merged = distributor_dicts[d]
            merged['id'] = d
            result.append(merged)
        return result
Beispiel #3
0
    def distributors(self):
        """
        Returns the names and versions of all distributors loaded in the server.
        If no distributors are found, an empty list is returned.

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

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