Example #1
0
def get_tags(request, values):
    """
    Description:  Get the list of tags.

    Params:      $values - Hash: keys must match valid search fields.
        +------------------------------------------------------------+
        |                   tag Search Parameters                    |
        +------------------------------------------------------------+
        | Key                     | Valid Values                     |
        | ids                     | List of Integer                  |
        | names                   | List of String                   |
        +------------------------------------------------------------+

    Returns:     Array: An array of tag object hashes.

    Example:

    >>> values= {'ids': [121, 123]}
    >>> Tag.get_tags(values)
    """
    if values.get('ids'):
        query = {'id__in': values.get('ids')}
        return TestTag.to_xmlrpc(query)
    elif values.get('names'):
        query = {'name__in': values.get('names')}
        return TestTag.to_xmlrpc(query)
    else:
        raise
Example #2
0
def get(request, case_id):
    """
    Description: Used to load an existing test case from the database.

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

    Returns:     A blessed TestCase object Hash

    Example:
    >>> TestCase.get(1193)
    """
    try:
        tc = TestCase.objects.get(case_id = case_id)
    except:
        raise

    tc_latest_text = tc.latest_text().serialize()

    response = tc.serialize()
    response['text'] = tc_latest_text
    #get the xmlrpc tags
    tag_ids = tc.tag.values_list('id', flat=True)
    query = {'id__in': tag_ids}
    tags = TestTag.to_xmlrpc(query)
    #cut 'id' attribute off, only leave 'name' here
    tags_without_id = map(lambda x:x["name"], tags)
    #replace tag_id list in the serialize return data
    response["tag"] = tags_without_id
    return response
Example #3
0
def get_tags(request, case_id):
    """
    Description: Get the list of tags attached to this case.

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

    Returns:     Array: An array of tag object hashes.

    Example:
    >>> TestCase.get_tags(12345)
    """
    try:
        tc = TestCase.objects.get(case_id = case_id)
    except:
        raise

    tag_ids = tc.tag.values_list('id', flat=True)
    query = {'id__in': tag_ids}
    return TestTag.to_xmlrpc(query)
Example #4
0
def get_tags(request, plan_id):
    """
    Description: Get the list of tags attached to this plan.

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

    Returns:     Array: An array of tag object hashes.

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

    tag_ids = tp.tag.values_list('id', flat=True)
    query = {'id__in': tag_ids}
    return TestTag.to_xmlrpc(query)
Example #5
0
    Params:      $id - Integer/String: An integer representing the ID of this plan in the database

    Returns:     Hash: A blessed TestPlan object hash

    Example:
    >>> TestPlan.get(137)
    """
    try:
        tp = TestPlan.objects.get(plan_id = plan_id)
    except TestPlan.DoesNotExist, error:
        return error
    response = tp.serialize()
    #get the xmlrpc tags
    tag_ids = tp.tag.values_list('id', flat=True)
    query = {'id__in': tag_ids}
    tags = TestTag.to_xmlrpc(query)
    #cut 'id' attribute off, only leave 'name' here
    tags_without_id = map(lambda x:x["name"], tags)
    #replace tag_id list in the serialize return data
    response["tag"] = tags_without_id
    return response

def get_change_history(request, plan_id):
    """
    *** FIXME: NOT IMPLEMENTED - History is different than before ***
    Description: Get the list of changes 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 changed fields and their details.
    """