Esempio n. 1
0
def filter(request, values={}):
    """
    Description: Performs a search and returns the resulting list of test cases.

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

        +----------------------------------------------------------------+
        |               Case-Run Search Parameters                       |
        +----------------------------------------------------------------+
        |        Key          |          Valid Values                    |
        | case_run_id         | Integer                                  |
        | assignee            | ForeignKey: Auth.User                    |
        | build               | ForeignKey: Build                        |
        | case                | ForeignKey: Test Case                    |
        | case_run_status     | ForeignKey: Case Run Status              |
        | notes               | String                                   |
        | run                 | ForeignKey: Test Run                     |
        | tested_by           | ForeignKey: Auth.User                    |
        | running_date        | Datetime                                 |
        | close_date          | Datetime                                 |
        +----------------------------------------------------------------+

    Returns:     Object: Matching test cases are retuned in a list of hashes.

    Example:
    # Get all case runs contain 'TCMS' in case summary
    >>> TestCaseRun.filter({'case__summary__icontain': 'TCMS'})
    """
    return TestCaseRun.to_xmlrpc(values)
Esempio n. 2
0
def filter(request, values={}):
    """
    Description: Performs a search and returns the resulting list of test cases.

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

        +----------------------------------------------------------------+
        |               Case-Run Search Parameters                       |
        +----------------------------------------------------------------+
        |        Key          |          Valid Values                    |
        | case_run_id         | Integer                                  |
        | assignee            | ForeignKey: Auth.User                    |
        | build               | ForeignKey: Build                        |
        | case                | ForeignKey: Test Case                    |
        | case_run_status     | ForeignKey: Case Run Status              |
        | notes               | String                                   |
        | run                 | ForeignKey: Test Run                     |
        | tested_by           | ForeignKey: Auth.User                    |
        | running_date        | Datetime                                 |
        | close_date          | Datetime                                 |
        +----------------------------------------------------------------+

    Returns:     Object: Matching test cases are retuned in a list of hashes.

    Example:
    # Get all case runs contain 'TCMS' in case summary
    >>> TestCaseRun.filter({'case__summary__icontain': 'TCMS'})
    """
    return TestCaseRun.to_xmlrpc(values)
Esempio n. 3
0
def filter(request, values={}):
    """Performs a search and returns the resulting list of test cases.

    :param dict values: a mapping containing these criteria.

        * case_run_id: (int)
        * assignee: ForeignKey: Auth.User
        * build: ForeignKey: TestBuild
        * case: ForeignKey: TestCase
        * case_run_status: ForeignKey: TestCaseRunStatus
        * notes: (str)
        * run: ForeignKey: TestRun
        * tested_by: ForeignKey: Auth.User
        * running_date: Datetime
        * close_date: Datetime

    :return: a list of found :class:`TestCaseRun`.
    :rtype: list[dict]

    Example::

        # Get all case runs contain 'TCMS' in case summary
        >>> TestCaseRun.filter({'case__summary__icontain': 'TCMS'})
    """
    return TestCaseRun.to_xmlrpc(values)
Esempio n. 4
0
def filter(request, values={}):
    """Performs a search and returns the resulting list of test cases.

    :param dict values: a mapping containing these criteria.

        * case_run_id: (int)
        * assignee: ForeignKey: Auth.User
        * build: ForeignKey: TestBuild
        * case: ForeignKey: TestCase
        * case_run_status: ForeignKey: TestCaseRunStatus
        * notes: (str)
        * run: ForeignKey: TestRun
        * tested_by: ForeignKey: Auth.User
        * running_date: Datetime
        * close_date: Datetime

    :return: a list of found :class:`TestCaseRun`.
    :rtype: list[dict]

    Example::

        # Get all case runs contain 'TCMS' in case summary
        >>> TestCaseRun.filter({'case__summary__icontain': 'TCMS'})
    """
    return TestCaseRun.to_xmlrpc(values)
Esempio n. 5
0
def filter(values):  # pylint: disable=redefined-builtin
    """
    .. function:: XML-RPC TestCaseRun.filter(values)

        Perform a search and return the resulting list of test case executions.

        :param values: Field lookups for :class:`tcms.testruns.models.TestCaseRun`
        :type values: dict
        :return: List of serialized :class:`tcms.testruns.models.TestCaseRun` objects
        :rtype: list(dict)
    """
    return TestCaseRun.to_xmlrpc(values)
Esempio n. 6
0
def get_test_case_runs(request, run_id):
    """Get the list of cases that this run is linked to.

    :param int run_id: run ID.
    :return: a list of mappings of found :class:`TestCaseRun`.
    :rtype: list[dict]

    Example::

        # Get all of case runs
        TestRun.get_test_case_runs(1)
    """
    return TestCaseRun.to_xmlrpc({'run__run_id': run_id})
Esempio n. 7
0
def get_test_case_runs(request, run_id):
    """Get the list of cases that this run is linked to.

    :param int run_id: run ID.
    :return: a list of mappings of found :class:`TestCaseRun`.
    :rtype: list[dict]

    Example::

        # Get all of case runs
        >>> TestRun.get_test_case_runs(1)
    """
    return TestCaseRun.to_xmlrpc({'run__run_id': run_id})
Esempio n. 8
0
def get_test_case_runs(request, run_id):
    """
    Description: Get the list of cases that this run is linked to.

    Params:      $run_id - Integer: An integer representing the ID in the database
                                    for this run.

    Returns:     Array: An array of test case-run object hashes.

    Example:
    # Get all of case runs
    >>> TestRun.get_test_case_runs(1193)
    """
    return TestCaseRun.to_xmlrpc({'run__run_id': run_id})
Esempio n. 9
0
def get_test_case_runs(request, run_id):
    """
    Description: Get the list of cases that this run is linked to.

    Params:      $run_id - Integer: An integer representing the ID in the database
                                    for this run.

    Returns:     Array: An array of test case-run object hashes.

    Example:
    # Get all of case runs
    >>> TestRun.get_test_case_runs(1193)
    """
    return TestCaseRun.to_xmlrpc({'run__run_id': run_id})
Esempio n. 10
0
def get_caseruns(request, build_id):
    """Returns the list of case runs that this Build is used in.

    :param int build_id: build ID.
    :return: list of mappings of found case runs.

    Example::

        >>> Build.get_caseruns(1234)
    """
    from tcms.testruns.models import TestCaseRun

    tb = TestBuild.objects.get(build_id=build_id)
    query = {'build': tb}

    return TestCaseRun.to_xmlrpc(query)
Esempio n. 11
0
def get_caseruns(request, build_id):
    """Returns the list of case runs that this Build is used in.

    :param int build_id: build ID.
    :return: list of mappings of found case runs.

    Example::

        >>> Build.get_caseruns(1234)
    """
    from tcms.testruns.models import TestCaseRun

    tb = TestBuild.objects.get(build_id=build_id)
    query = {'build': tb}

    return TestCaseRun.to_xmlrpc(query)
Esempio n. 12
0
def get_caseruns(request, build_id):
    """
    Description: Returns the list of case-runs that this Build is used in.

    Params:      $id -  Integer: Build ID.

    Returns:     Array: List of case-run object hashes.

    Example:
    >>> Build.get_caseruns(1234)
    """
    from tcms.testruns.models import TestCaseRun

    tb = TestBuild.objects.get(build_id=build_id)
    query = {"build": tb}

    return TestCaseRun.to_xmlrpc(query)
Esempio n. 13
0
File: build.py Progetto: thr27/Kiwi
def get_caseruns(request, build_id):
    """
    Description: Returns the list of case-runs that this Build is used in.

    Params:      $id -  Integer: Build ID.

    Returns:     Array: List of case-run object hashes.

    Example:
    >>> Build.get_caseruns(1234)
    """
    from tcms.testruns.models import TestCaseRun

    tb = TestBuild.objects.get(build_id=build_id)
    query = {'build': tb}

    return TestCaseRun.to_xmlrpc(query)
Esempio n. 14
0
def get_caseruns(build_id):
    """
    .. function:: XML-RPC Build.get_caseruns(build_id)

        Returns the list of case-runs that this Build is used in.

        :param build_id: the object ID
        :type build_id: int
        :return: List of serialized :class:`tcms.testruns.models.TestCaseRun` objects
        :rtype: list(dict)
        :raises: TestBuild.DoesNotExist if build not found
    """
    from tcms.testruns.models import TestCaseRun

    tb = TestBuild.objects.get(build_id=build_id)
    query = {'build': tb}

    return TestCaseRun.to_xmlrpc(query)
Esempio n. 15
0
def update(request, case_run_ids, values):
    """Updates the fields of the selected case-runs.

    :param case_run_ids: give one or more case run IDs. It could be an integer,
        a string containing comma separated IDs, or a list of int each of them
        is a case run ID.
    :type run_ids: int, str or list
    :param dict values: a mapping containing these data to update specified
        case runs.

        * build: (int)
        * assignee: (int)
        * case_run_status: (int)
        * notes: (str)
        * sortkey: (int)

    :return: In the case of a single object, it is returned. If a list was
        passed, it returns an array of object hashes. If the update on any
        particular object failed, the hash will contain a ERROR key and the
        message as to why it failed.

    Example::

        # Update alias to 'tcms' for case 12345 and 23456
        >>> TestCaseRun.update([12345, 23456], {'assignee': 2206})
    """
    from datetime import datetime
    from tcms.core import forms
    from tcms.testruns.forms import XMLRPCUpdateCaseRunForm

    pks_to_update = pre_process_ids(case_run_ids)

    tcrs = TestCaseRun.objects.filter(pk__in=pks_to_update)
    form = XMLRPCUpdateCaseRunForm(values)

    if form.is_valid():
        data = {}

        if form.cleaned_data['build']:
            data['build'] = form.cleaned_data['build']

        if form.cleaned_data['assignee']:
            data['assignee'] = form.cleaned_data['assignee']

        if form.cleaned_data['case_run_status']:
            data['case_run_status'] = form.cleaned_data['case_run_status']
            data['tested_by'] = request.user
            data['close_date'] = datetime.now()

        if 'notes' in values:
            if values['notes'] in (None, ''):
                data['notes'] = values['notes']
            if form.cleaned_data['notes']:
                data['notes'] = form.cleaned_data['notes']

        if form.cleaned_data['sortkey'] is not None:
            data['sortkey'] = form.cleaned_data['sortkey']

        tcrs.update(**data)

    else:
        raise ValueError(forms.errors_to_list(form))

    query = {'pk__in': pks_to_update}
    return TestCaseRun.to_xmlrpc(query)
Esempio n. 16
0
def update(request, case_run_ids, values):
    """
    Description: Updates the fields of the selected case-runs.

    Params:      $caserun_ids - Integer/String/Array
                        Integer: A single TestCaseRun ID.
                        String:  A comma separates string of TestCaseRun IDs for batch
                                 processing.
                        Array:   An array of TestCaseRun IDs for batch mode processing

                 $values - Hash of keys matching TestCaseRun fields and the new values
                 to set each field to.
                         +--------------------+----------------+
                         | Field              | Type           |
                         +--------------------+----------------+
                         | build              | Integer        |
                         | assignee           | Integer        |
                         | case_run_status    | Integer        |
                         | notes              | String         |
                         | sortkey            | Integer        |
                         +--------------------+----------------+

    Returns:     Hash/Array: In the case of a single object, it is returned. If a
                 list was passed, it returns an array of object hashes. If the
                 update on any particular object failed, the hash will contain a
                 ERROR key and the message as to why it failed.

    Example:
    # Update alias to 'tcms' for case 12345 and 23456
    >>> TestCaseRun.update([12345, 23456], {'assignee': 2206})
    """
    from datetime import datetime
    from tcms.core import forms
    from tcms.testruns.forms import XMLRPCUpdateCaseRunForm

    pks_to_update = pre_process_ids(case_run_ids)

    tcrs = TestCaseRun.objects.filter(pk__in=pks_to_update)
    form = XMLRPCUpdateCaseRunForm(values)

    if form.is_valid():
        data = {}

        if form.cleaned_data['build']:
            data['build'] = form.cleaned_data['build']

        if form.cleaned_data['assignee']:
            data['assignee'] = form.cleaned_data['assignee']

        if form.cleaned_data['case_run_status']:
            data['case_run_status'] = form.cleaned_data['case_run_status']
            data['tested_by'] = request.user
            data['close_date'] = datetime.now()

        if 'notes' in values:
            if values['notes'] in (None, ''):
                data['notes'] = values['notes']
            if form.cleaned_data['notes']:
                data['notes'] = form.cleaned_data['notes']

        if form.cleaned_data['sortkey'] is not None:
            data['sortkey'] = form.cleaned_data['sortkey']

        tcrs.update(**data)

    else:
        raise ValueError(forms.errors_to_list(form))

    query = {'pk__in': pks_to_update}
    return TestCaseRun.to_xmlrpc(query)
Esempio n. 17
0
def update(request, case_run_ids, values):
    """Updates the fields of the selected case-runs.

    :param case_run_ids: give one or more case run IDs. It could be an integer,
        a string containing comma separated IDs, or a list of int each of them
        is a case run ID.
    :type run_ids: int, str or list
    :param dict values: a mapping containing these data to update specified
        case runs.

        * build: (int)
        * assignee: (int)
        * case_run_status: (int)
        * notes: (str)
        * sortkey: (int)

    :return: In the case of a single object, it is returned. If a list was
        passed, it returns an array of object hashes. If the update on any
        particular object failed, the hash will contain a ERROR key and the
        message as to why it failed.

    Example::

        # Update alias to 'tcms' for case 12345 and 23456
        >>> TestCaseRun.update([12345, 23456], {'assignee': 2206})
    """
    from datetime import datetime
    from tcms.core import forms
    from tcms.testruns.forms import XMLRPCUpdateCaseRunForm

    pks_to_update = pre_process_ids(case_run_ids)

    tcrs = TestCaseRun.objects.filter(pk__in=pks_to_update)
    form = XMLRPCUpdateCaseRunForm(values)

    if form.is_valid():
        data = {}

        if form.cleaned_data['build']:
            data['build'] = form.cleaned_data['build']

        if form.cleaned_data['assignee']:
            data['assignee'] = form.cleaned_data['assignee']

        if form.cleaned_data['case_run_status']:
            data['case_run_status'] = form.cleaned_data['case_run_status']
            data['tested_by'] = request.user
            data['close_date'] = datetime.now()

        if 'notes' in values:
            if values['notes'] in (None, ''):
                data['notes'] = values['notes']
            if form.cleaned_data['notes']:
                data['notes'] = form.cleaned_data['notes']

        if form.cleaned_data['sortkey'] is not None:
            data['sortkey'] = form.cleaned_data['sortkey']

        tcrs.update(**data)

    else:
        raise ValueError(forms.errors_to_list(form))

    query = {'pk__in': pks_to_update}
    return TestCaseRun.to_xmlrpc(query)
Esempio n. 18
0
def update(request, case_run_ids, values):
    """
    Description: Updates the fields of the selected case-runs.

    Params:      $caserun_ids - Integer/String/Array
                        Integer: A single TestCaseRun ID.
                        String:  A comma separates string of TestCaseRun IDs for batch
                                 processing.
                        Array:   An array of TestCaseRun IDs for batch mode processing

                 $values - Hash of keys matching TestCaseRun fields and the new values
                 to set each field to.
                         +--------------------+----------------+
                         | Field              | Type           |
                         +--------------------+----------------+
                         | build              | Integer        |
                         | assignee           | Integer        |
                         | case_run_status    | Integer        |
                         | notes              | String         |
                         | sortkey            | Integer        |
                         +--------------------+----------------+

    Returns:     Hash/Array: In the case of a single object, it is returned. If a
                 list was passed, it returns an array of object hashes. If the
                 update on any particular object failed, the hash will contain a
                 ERROR key and the message as to why it failed.

    Example:
    # Update alias to 'tcms' for case 12345 and 23456
    >>> TestCaseRun.update([12345, 23456], {'assignee': 2206})
    """
    from datetime import datetime
    from tcms.core import forms
    from tcms.testruns.forms import XMLRPCUpdateCaseRunForm

    pks_to_update = pre_process_ids(case_run_ids)

    tcrs = TestCaseRun.objects.filter(pk__in=pks_to_update)
    form = XMLRPCUpdateCaseRunForm(values)

    if form.is_valid():
        data = {}

        if form.cleaned_data['build']:
            data['build'] = form.cleaned_data['build']

        if form.cleaned_data['assignee']:
            data['assignee'] = form.cleaned_data['assignee']

        if form.cleaned_data['case_run_status']:
            data['case_run_status'] = form.cleaned_data['case_run_status']
            data['tested_by'] = request.user
            data['close_date'] = datetime.now()

        if 'notes' in values:
            if values['notes'] in (None, ''):
                data['notes'] = values['notes']
            if form.cleaned_data['notes']:
                data['notes'] = form.cleaned_data['notes']

        if form.cleaned_data['sortkey'] is not None:
            data['sortkey'] = form.cleaned_data['sortkey']

        tcrs.update(**data)

    else:
        raise ValueError(forms.errors_to_list(form))

    query = {'pk__in': pks_to_update}
    return TestCaseRun.to_xmlrpc(query)