Ejemplo n.º 1
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 nitrate.apps.management.models import TCMSEnvValue
    query = {'testrun__pk': run_id}
    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 2
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': is_active }
    if env_property_id: query['property__pk'] = env_property_id

    return TCMSEnvValue.to_xmlrpc(query)
Ejemplo n.º 3
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'})
    """
    return TCMSEnvValue.to_xmlrpc(query)