Esempio n. 1
0
def filter_groups(request, query):
    """
    Description: Performs a search and returns the resulting list of env groups.

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

    +------------------------------------------------------------------+
    |               Product Search Parameters                          |
    +------------------------------------------------------------------+
    |        Key          |          Valid Values                      |
    | id                  | Integer: ID of env group                   |
    | name                | String                                     |
    | manager             | ForeignKey: Auth.user                      |
    | modified_by         | ForeignKey: Auth.user                      |
    | is_active           | Boolean                                    |
    | property            | ForeignKey: TCMSEnvProperty                |
    +------------------------------------------------------------------+

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

    Example:
    # Get all of env group name contains 'Desktop'
    >>> Env.filter_groups({'name__icontains': 'Desktop'})
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvGroup.to_xmlrpc(query)
Esempio n. 2
0
File: env.py Progetto: jetlyb/Kiwi
def filter_groups(query):
    """
    .. function:: XML-RPC Env.filter_groups(query)

        Perform a search and return the resulting list of env groups.
        Parameter ``query`` is dict which recognizes the following
        keys:

        :param id: ID of env group
        :type id: int
        :param name: Name of env group
        :type name: str
        :param manager: Manager of this group. ForeignKey!
        :type manager: int or ``settings.AUTH_USER_MODEL`` object
        :param modified_by: Who modified the group. ForeignKey!
        :type modified_by: int or ``settings.AUTH_USER_MODEL`` object
        :param is_active: if this group is active or not
        :type is_active: bool
        :param property: Group property. ForeignKey
        :type property: int or :class:`tcms.management.models.TCMSEnvProperty`
        :returns: List of serialized env groups that match the query
        :rtype: list(dict)

    Query keys support the double-underscore field lookups from Django.
    For example to get all of env group with name containing 'Desktop'::

        >>> Env.filter_groups({'name__icontains': 'Desktop'})
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvGroup.to_xmlrpc(query)
Esempio n. 3
0
def get_env_groups(request, plan_id):
    """Get the list of env groups to the fields of this plan.

    :param int plan_id: plan ID.
    :return: list of mappings of found :class:`TCMSEnvGroup`.
    :rtype: list[dict]
    """
    from tcms.management.models import TCMSEnvGroup

    query = {'testplan__pk': plan_id}
    return TCMSEnvGroup.to_xmlrpc(query)
Esempio n. 4
0
def get_env_groups(request, plan_id):
    """Get the list of env groups to the fields of this plan.

    :param int plan_id: plan ID.
    :return: list of mappings of found :class:`TCMSEnvGroup`.
    :rtype: list[dict]
    """
    from tcms.management.models import TCMSEnvGroup

    query = {'testplan__pk': plan_id}
    return TCMSEnvGroup.to_xmlrpc(query)
Esempio n. 5
0
def get_env_groups(plan_id):
    """
    Description: Get the list of env groups to the fields of this plan.

    Params:      $plan_id - Integer: An integer representing the ID of this plan in the database

    Returns:     Array: An array of hashes with env groups.
    """
    from tcms.management.models import TCMSEnvGroup

    query = {'testplan__pk': plan_id}
    return TCMSEnvGroup.to_xmlrpc(query)
Esempio n. 6
0
def get_env_groups(request, plan_id):
    """
    Description: Get the list of env groups to the fields of this plan.

    Params:      $plan_id - Integer: An integer representing the ID of this plan in the database

    Returns:     Array: An array of hashes with env groups.
    """
    from tcms.management.models import TCMSEnvGroup

    query = {'testplan__pk': plan_id}
    return TCMSEnvGroup.to_xmlrpc(query)
Esempio n. 7
0
def filter(query):
    """
    .. function:: XML-RPC Env.Group.filter(query)

        Perform a search and return the resulting list of
        :class:`tcms.management.models.TCMSEnvGroup` objects.

        :param query: Field lookups for :class:`tcms.management.models.TCMSEnvGroup`
        :type query: dict
        :returns: List of serialized :class:`tcms.management.models.TCMSEnvGroup` objects
        :rtype: list(dict)
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvGroup.to_xmlrpc(query)
Esempio n. 8
0
def filter_groups(request, query):
    """Performs a search and returns the resulting list of env groups.

    :param dict query: mapping containing following criteria to find out
        envrionment groups.

        * id: (int) environment group ID.
        * name: (str) environment group name.
        * manager: ForeignKey: Auth.user
        * modified_by: ForeignKey: Auth.user
        * is_active: (bool)
        * property: ForeignKey: :class:`TCMSEnvProperty`

    :return: list of mappings of found environment groups.
    :rtype: list

    Example::

        # Get all of env group name contains 'Desktop'
        >>> Env.filter_groups({'name__icontains': 'Desktop'})
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvGroup.to_xmlrpc(query)