예제 #1
0
파일: product.py 프로젝트: xltian/nitrate
def filter_components(request, query):
    """
    Description: Performs a search and returns the resulting list of components.

    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                        |
    | initial_owner       | ForeignKey: Auth.User                      |
    | initial_qa_contact  | ForeignKey: Auth.User                      |
    | description         | String                                     |
    +------------------------------------------------------------------+

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

    Example:
    # Get all of components named like 'libvirt'
    >>> Product.filter_components({'name__icontains': 'libvirt'})
    # Get all of components named in product 'Red Hat Enterprise Linux 5'
    >>> Product.filter_components({'product__name': 'Red Hat Enterprise Linux 5'})
    """
    from tcms.apps.management.models import Component
    return Component.to_xmlrpc(query)
예제 #2
0
def filter_components(request, query):
    """
    Description: Performs a search and returns the resulting list of components.

    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                        |
    | initial_owner       | ForeignKey: Auth.User                      |
    | initial_qa_contact  | ForeignKey: Auth.User                      |
    | description         | String                                     |
    +------------------------------------------------------------------+

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

    Example:
    # Get all of components named like 'libvirt'
    >>> Product.filter_components({'name__icontains': 'libvirt'})
    # Get all of components named in product 'Red Hat Enterprise Linux 5'
    >>> Product.filter_components({'product__name': 'Red Hat Enterprise Linux 5'})
    """
    from tcms.apps.management.models import Component

    return Component.to_xmlrpc(query)
예제 #3
0
def get_components(request, plan_id):
    """
    Description: Get the list of components attached to this plan.

    Params:      $plan_id - Integer/String: An integer representing the ID in the database

    Returns:     Array: An array of component object hashes.

    Example:
    >>> TestPlan.get_components(12345)
    """
    try:
        tp = TestPlan.objects.get(plan_id=plan_id)
    except:
        raise

    component_ids = tp.component.values_list('id', flat=True)
    query = {'id__in': component_ids}
    return Component.to_xmlrpc(query)
예제 #4
0
def get_components(request, plan_id):
    """
    Description: Get the list of components attached to this plan.

    Params:      $plan_id - Integer/String: An integer representing the ID in the database

    Returns:     Array: An array of component object hashes.

    Example:
    >>> TestPlan.get_components(12345)
    """
    try:
        tp = TestPlan.objects.get(plan_id=plan_id)
    except:
        raise

    component_ids = tp.component.values_list('id', flat=True)
    query = {'id__in': component_ids}
    return Component.to_xmlrpc(query)
예제 #5
0
파일: testcase.py 프로젝트: xltian/nitrate
def get_components(request, case_id):
    """"
    Description: Get the list of components attached to this case.

    Params:      $case_id - Integer/String: An integer representing the ID in the database

    Returns:     Array: An array of component object hashes.

    Example:
    >>> TestCase.get_components(12345)
    """
    from tcms.apps.management.models import Component
    try:
        tc = TestCase.objects.get(case_id = case_id)
    except:
        raise

    component_ids = tc.component.values_list('id', flat = True)
    query = {'id__in': component_ids}
    return Component.to_xmlrpc(query)
예제 #6
0
파일: product.py 프로젝트: xltian/nitrate
def get_components(request, product):
    """
    Description: Get the list of components 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 Component objects.

    Example:
    # Get with product id
    >>> Product.get_components(61)
    # Get with product name
    >>> Product.get_components('Red Hat Enterprise Linux 5')
    """
    from tcms.apps.management.models import Component
    p = pre_check_product(values = product)
    query = {'product': p}
    return Component.to_xmlrpc(query)
예제 #7
0
def get_components(request, product):
    """
    Description: Get the list of components 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 Component objects.

    Example:
    # Get with product id
    >>> Product.get_components(61)
    # Get with product name
    >>> Product.get_components('Red Hat Enterprise Linux 5')
    """
    from tcms.apps.management.models import Component

    p = pre_check_product(values=product)
    query = {'product': p}
    return Component.to_xmlrpc(query)
예제 #8
0
def get_components(request, case_id):
    """"
    Description: Get the list of components attached to this case.

    Params:      $case_id - Integer/String: An integer representing the ID in the database

    Returns:     Array: An array of component object hashes.

    Example:
    >>> TestCase.get_components(12345)
    """
    from tcms.apps.management.models import Component

    try:
        tc = TestCase.objects.get(case_id=case_id)
    except:
        raise

    component_ids = tc.component.values_list('id', flat=True)
    query = {'id__in': component_ids}
    return Component.to_xmlrpc(query)