示例#1
0
文件: __init__.py 项目: nikron/bridge
    def serializable_asset_action_info(self, uuid, action):
        """
        Get the information of actions of an asset in base python primitives.
        Inforamtion mean to display to an asset about actions of an asset.

        :param uuid: The asset of the action.
        :type uuid: uuid

        :param action:
        :type action:

        :return: A serializable form of an asset, and None if there is an error.
        :rtype: dict
        """
        asset = self.get_asset(uuid)

        if asset:
            try:
                return get_action_information(asset, action)
            except ActionError:
                return None
        else:
            logging.error("{0} does not exist in this model, can not get action {1}.".format(type(uuid), action))
            return None
示例#2
0
 def test_get_action(self):
     act = get_action_information(self.inner, 'floop')
     self.assertEquals(act['name'], 'Flip the bit.')