Esempio n. 1
0
def add_comment(request, case_ids, comment):
    """
    Description: Adds comments to selected test cases.

    Params:      $case_ids - Integer/Array/String: An integer representing the ID in the database,
                             an array of case_ids, or a string of comma separated case_ids.

                 $comment - String - The comment

    Returns:     Array: empty on success or an array of hashes with failure
                        codes if a failure occured.

    Example:
    # Add comment 'foobar' to case 1234
    >>> TestCase.add_comment(1234, 'foobar')
    # Add 'foobar' to cases list [56789, 12345]
    >>> TestCase.add_comment([56789, 12345], 'foobar')
    # Add 'foobar' to cases list '56789, 12345' with String
    >>> TestCase.add_comment('56789, 12345', 'foobar')
    """
    from tcms.xmlrpc.utils import Comment

    object_pks = pre_process_ids(value=case_ids)
    c = Comment(
        request=request,
        content_type='testcases.testcase',
        object_pks=object_pks,
        comment=comment
    )

    return c.add()
Esempio n. 2
0
def add_comment(request, case_ids, comment):
    """Adds comments to selected test cases.

    :param case_ids: give one or more case IDs. It could be an integer, a
        string containing comma separated IDs, or a list of int each of them is
        a case ID.
    :type case_ids: int, str or list
    :param str comment: the comment content to add.
    :return: a list which is empty on success or a list of mappings with
        failure codes if a failure occured.

    Example::

        # Add comment 'foobar' to case 1
        >>> TestCase.add_comment(1, 'foobar')
        # Add 'foobar' to cases list [1, 2]
        >>> TestCase.add_comment([1, 2], 'foobar')
        # Add 'foobar' to cases list '1, 2' with String
        >>> TestCase.add_comment('1, 2', 'foobar')
    """
    from tcms.xmlrpc.utils import Comment

    object_pks = pre_process_ids(value=case_ids)
    c = Comment(
        request=request,
        content_type='testcases.testcase',
        object_pks=object_pks,
        comment=comment
    )

    return c.add()
Esempio n. 3
0
def add_comment(request, case_run_ids, comment):
    """Adds comments to selected test 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 str comment: the comment content to add.
    :return: a list which is empty on success or a list of mappings with
        failure codes if a failure occured.
    :rtype: list

    Example::

        # Add comment 'foobar' to case run 1
        >>> TestCaseRun.add_comment(1, 'foobar')
        # Add 'foobar' to case runs list [1, 2]
        >>> TestCaseRun.add_comment([1, 2], 'foobar')
        # Add 'foobar' to case runs list '1, 2' with String
        >>> TestCaseRun.add_comment('1, 2', 'foobar')
    """
    from tcms.xmlrpc.utils import Comment

    # FIXME: empty object_pks should be an ValueError
    object_pks = pre_process_ids(value=case_run_ids)
    c = Comment(request=request,
                content_type='testruns.testcaserun',
                object_pks=object_pks,
                comment=comment)

    return c.add()
Esempio n. 4
0
def add_comment(case_run_id, comment, **kwargs):
    """
    .. function:: XML-RPC TestCaseRun.add_comment(case_run_id, comment)

        Add comment to selected test case run.

        :param case_run_id: PK of a TestCaseRun object
        :param case_run_id: int
        :param comment: The text to add as a comment
        :param comment: str
        :return: None
    """
    Comment(
        request=kwargs.get(REQUEST_KEY),
        content_type='testruns.testcaserun',
        object_pks=[case_run_id],
        comment=comment
    ).add()