コード例 #1
0
def filter_categories(request, query):
    """
    Description: Performs a search and returns the resulting list of categories.

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

    +------------------------------------------------------------------+
    |              Component Search Parameters                         |
    +------------------------------------------------------------------+
    |        Key          |          Valid Values                      |
    | id                  | Integer: ID of product                     |
    | name                | String                                     |
    | product             | ForeignKey: Product                        |
    | description         | String                                     |
    +------------------------------------------------------------------+

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

    Example:
    # Get all of categories named like 'libvirt'
    >>> Product.filter_categories({'name__icontains': 'regression'})
    # Get all of categories named in product 'Red Hat Enterprise Linux 5'
    >>> Product.filter_categories({'product__name': 'Red Hat Enterprise Linux 5'})
    """
    from tcms.testcases.models import TestCaseCategory

    return TestCaseCategory.to_xmlrpc(query)
コード例 #2
0
ファイル: product.py プロジェクト: Aaln1986/Nitrate
def filter_categories(request, query):
    """
    Description: Performs a search and returns the resulting list of categories.

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

    +------------------------------------------------------------------+
    |              Component Search Parameters                         |
    +------------------------------------------------------------------+
    |        Key          |          Valid Values                      |
    | id                  | Integer: ID of product                     |
    | name                | String                                     |
    | product             | ForeignKey: Product                        |
    | description         | String                                     |
    +------------------------------------------------------------------+

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

    Example:
    # Get all of categories named like 'libvirt'
    >>> Product.filter_categories({'name__icontains': 'regression'})
    # Get all of categories named in product 'Red Hat Enterprise Linux 5'
    >>> Product.filter_categories({'product__name': 'Red Hat Enterprise Linux 5'})
    """
    from tcms.testcases.models import TestCaseCategory

    return TestCaseCategory.to_xmlrpc(query)
コード例 #3
0
ファイル: category.py プロジェクト: Shasthojoy/Kiwi
def filter(query):
    """
    .. function:: XML-RPC Category.filter(query)

        Search and return TestCaseCategory objects matching query.

        :param query: Field lookups for :class:`tcms.testcases.models.TestCaseCategory`
        :type query: dict
        :return: List of serialized :class:`tcms.testcases.models.TestCaseCategory` objects
        :rtype: list(dict)
    """
    return TestCaseCategory.to_xmlrpc(query)
コード例 #4
0
ファイル: product.py プロジェクト: zumbi/Nitrate
def get_categories(request, product):
    """Get the list of categories associated with this product.

    :param product: product ID or name.
    :type product: int or str
    :return: a list of mappings of :class:`TestCaseCategory`.
    :rtype: list

    Example:

        # Get with product id
        >>> Product.get_categories(61)
        # Get with product name
        >>> Product.get_categories('product name')
    """
    from tcms.testcases.models import TestCaseCategory

    p = pre_check_product(values=product)
    query = {'product': p}
    return TestCaseCategory.to_xmlrpc(query)
コード例 #5
0
ファイル: product.py プロジェクト: tkdchen/Nitrate
def get_categories(request, product):
    """Get the list of categories associated with this product.

    :param product: product ID or name.
    :type product: int or str
    :return: a list of mappings of :class:`TestCaseCategory`.
    :rtype: list

    Example:

        # Get with product id
        >>> Product.get_categories(61)
        # Get with product name
        >>> Product.get_categories('product name')
    """
    from tcms.testcases.models import TestCaseCategory

    p = pre_check_product(values=product)
    query = {'product': p}
    return TestCaseCategory.to_xmlrpc(query)
コード例 #6
0
def get_categories(request, product):
    """
    Description: Get the list of categories associated with this product.

    Params:      $product - Integer/String
                            Integer: product_id of the product in the Database
                            String: Product name

    Returns:     Array: Returns an array of Case Category objects.

    Example:
    # Get with product id
    >>> Product.get_categories(61)
    # Get with product name
    >>> Product.get_categories('Red Hat Enterprise Linux 5')
    """
    from tcms.testcases.models import TestCaseCategory

    p = pre_check_product(values=product)
    query = {'product': p}
    return TestCaseCategory.to_xmlrpc(query)
コード例 #7
0
ファイル: product.py プロジェクト: Aaln1986/Nitrate
def get_categories(request, product):
    """
    Description: Get the list of categories associated with this product.

    Params:      $product - Integer/String
                            Integer: product_id of the product in the Database
                            String: Product name

    Returns:     Array: Returns an array of Case Category objects.

    Example:
    # Get with product id
    >>> Product.get_categories(61)
    # Get with product name
    >>> Product.get_categories('Red Hat Enterprise Linux 5')
    """
    from tcms.testcases.models import TestCaseCategory

    p = pre_check_product(values=product)
    query = {'product': p}
    return TestCaseCategory.to_xmlrpc(query)
コード例 #8
0
ファイル: product.py プロジェクト: zumbi/Nitrate
def filter_categories(request, query):
    """Performs a search and returns the resulting list of categories.

    :param dict query: a mapping containing following criteria.

        * id: (int) category ID.
        * name: (str) category name.
        * product: ForeignKey: :class:`Product`.
        * description: (str) category description.

    :return: a mapping representing found category.
    :rtype: dict

    Example::

        # Get all of categories named like 'libvirt'
        >>> Product.filter_categories({'name__icontains': 'regression'})
        # Get all of categories named in product 'product name'
        >>> Product.filter_categories({'product__name': 'product name'})
    """
    from tcms.testcases.models import TestCaseCategory

    return TestCaseCategory.to_xmlrpc(query)
コード例 #9
0
ファイル: product.py プロジェクト: tkdchen/Nitrate
def filter_categories(request, query):
    """Performs a search and returns the resulting list of categories.

    :param dict query: a mapping containing following criteria.

        * id: (int) category ID.
        * name: (str) category name.
        * product: ForeignKey: :class:`Product`.
        * description: (str) category description.

    :return: a mapping representing found category.
    :rtype: dict

    Example::

        # Get all of categories named like 'libvirt'
        >>> Product.filter_categories({'name__icontains': 'regression'})
        # Get all of categories named in product 'product name'
        >>> Product.filter_categories({'product__name': 'product name'})
    """
    from tcms.testcases.models import TestCaseCategory

    return TestCaseCategory.to_xmlrpc(query)