Ejemplo n.º 1
0
def filter_values(request, query):
    """
    Description: Performs a search and returns the resulting list of env properties.

    Params:      $query - Hash: keys must match valid search fields.

    +------------------------------------------------------------------+
    |               Product Search Parameters                          |
    +------------------------------------------------------------------+
    |        Key          |          Valid Values                      |
    | id                  | Integer: ID of env value                   |
    | value               | String                                     |
    | is_active           | Boolean                                    |
    | property            | ForeignKey: TCMSEnvProperty                |
    +------------------------------------------------------------------+

    Returns:     Array: Matching env values are retuned in a list of hashes.

    Example:
    # Get all of env values name contains 'Desktop'
    >>> Env.filter_values({'name__icontains': 'Desktop'})
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 2
0
Archivo: env.py Proyecto: jetlyb/Kiwi
def filter_values(query):
    """
    .. function:: XML-RPC Env.filter_values(query)

        Performs a search and returns the resulting list of env values.
        Parameter ``query`` is dict which recognizes the following
        keys:

        :param id: ID of env value
        :type id: int
        :param value: Object value
        :type value: str
        :param is_active:
        :type is_active: bool
        :param property: ForeignKey: TCMSEnvProperty
        :type property: int or :class:`tcms.management.models.TCMSEnvProperty`
        :returns: List of serialized env values matching the query
        :rtype: list(dict)

        For example to get all env values containing 'Desktop'::

            >>> Env.filter_values({'value__icontains': 'Desktop'})
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 3
0
def filter(query):
    """
    .. function:: XML-RPC Env.Value.filter(query)

        Performs a search and returns the resulting list of environment values.

        :param query: Field lookups for :class:`tcms.management.models.TCMSEnvValue`
        :type query: dict
        :returns: List of serialized :class:`tcms.management.models.TCMSEnvValue` objects
        :rtype: list(dict)
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 4
0
def get_env_values(request, run_id):
    """Get the list of env values to this run.

    :param int run_id: run ID.
    :return: a mapping representing found :class:`TCMSEnvValue`.
    :rtype: dict

    Example::

        TestRun.get_env_values(8)
    """
    from tcms.management.models import TCMSEnvValue

    query = {'testrun__pk': run_id}
    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 5
0
def get_env_values(request, run_id):
    """
    Description: Get the list of env values to this run.

    Params:      $run_id - Integer: An integer representing the ID of the run in the database

    Returns:     Array: An array of tag object hashes.

    Example:
    >>> TestRun.get_env_values(8748)
    """
    from tcms.management.models import TCMSEnvValue

    query = {'testrun__pk': run_id}
    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 6
0
def get_env_values(request, run_id):
    """
    Description: Get the list of env values to this run.

    Params:      $run_id - Integer: An integer representing the ID of the run in the database

    Returns:     Array: An array of tag object hashes.

    Example:
    >>> TestRun.get_env_values(8748)
    """
    from tcms.management.models import TCMSEnvValue

    query = {'testrun__pk': run_id}
    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 7
0
def get_env_values(request, run_id):
    """Get the list of env values to this run.

    :param int run_id: run ID.
    :return: a mapping representing found :class:`TCMSEnvValue`.
    :rtype: dict

    Example::

        >>> TestRun.get_env_values(8)
    """
    from tcms.management.models import TCMSEnvValue

    query = {'testrun__pk': run_id}
    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 8
0
def filter_values(request, query):
    """Performs a search and returns the resulting list of env properties.

    :param dict query: mapping containing these criteria.

        * id: (int) ID of env value
        * value: (str)
        * is_active: (bool)
        * property: ForeignKey: :class:`TCMSEnvProperty`

    :return: list of mappings containing found environment property values.
    :rtype: list

    Example::

        # Get all of env values name contains 'Desktop'
        >>> Env.filter_values({'name__icontains': 'Desktop'})
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 9
0
def get_values(request, env_property_id=None, is_active=True):
    """
    Description: Get the list of values associated with this env property.

    Params:      $env_property_id - Integer: env_property_id of the env property in the Database
                                    Return all of values when the argument is not specific.
                 $is_active       - Boolean: True to only include builds where is_active is true.
                                    Default: True
    Returns:     Array: Returns an array of env values objects.

    Example:
    # Get all of properties
    >>> Env.get_properties()
    # Get the properties in group 10
    >>> Env.get_properties(10)
    """
    query = {'is_active': parse_bool_value(is_active)}
    if env_property_id:
        query['property__pk'] = env_property_id

    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 10
0
def get_values(request, env_property_id=None, is_active=True):
    """Get the list of values associated with this env property.

    :param int env_property_id: environment property ID. If omitted, all
        environment property values will be returned.
    :param bool is_active: indicate whether to get values from active
        properties. Default is ``True``.
    :return: list of mappings containing found environment property values.
    :rtype: list

    Example::

        # Get all values from active environment properties
        >>> Env.get_values()
        # Get the properties in group 10
        >>> Env.get_values(10)
    """
    query = {'is_active': parse_bool_value(is_active)}
    if env_property_id:
        query['property__pk'] = env_property_id

    return TCMSEnvValue.to_xmlrpc(query)