tcms.rpc.api.testcase module

tcms.rpc.api.testcase.create(values, **kwargs)[source]
XML-RPC TestCase.create(values)

Create a new TestCase object and store it in the database.

Parameters:
  • values (dict) – Field values for tcms.testcases.models.TestCase
  • kwargs – Dict providing access to the current request, protocol entry point name and handler instance from the rpc method
Returns:

Serialized tcms.testcases.models.TestCase object

Return type:

dict

Raises:
  • ValueError – if form is not valid
  • PermissionDenied – if missing testcases.add_testcase permission

Minimal test case parameters:

>>> values = {
    'category': 135,
    'product': 61,
'summary': 'Testing XML-RPC',
'priority': 1,
}
>>> TestCase.create(values)
tcms.rpc.api.testcase.update(case_id, values)[source]
XML-RPC TestCase.update(case_id, values)

Update the fields of the selected test case.

Parameters:
Returns:

Serialized tcms.testcases.models.TestCase object

Return type:

dict

Raises:
  • ValueError – if form is not valid
  • TestCase.DoesNotExist – if object specified by PK doesn’t exist
  • PermissionDenied – if missing testcases.change_testcase permission
tcms.rpc.api.testcase.filter(query=None)[source]
XML-RPC TestCase.filter(query)

Perform a search and return the resulting list of test cases augmented with their latest text.

Parameters:query (dict) – Field lookups for tcms.testcases.models.TestCase
Returns:Serialized list of tcms.testcases.models.TestCase objects.
Return type:list(dict)
tcms.rpc.api.testcase.remove(query)[source]
XML-RPC TestCase.remove(query)

Remove TestCase object(s).

Parameters:query (dict) – Field lookups for tcms.testcases.models.TestCase
Raises:PermissionDenied if missing the testcases.delete_testcase permission
Returns:The number of objects deleted and a dictionary with the number of deletions per object type.
Return type:int, dict

Example - removing bug from TestCase:

>>> TestCase.remove({
    'pk__in': [1, 2, 3, 4],
})
tcms.rpc.api.testcase.add_comment(case_id, comment, **kwargs)[source]
TestCase.add_comment(case_id, comment)

Add comment to selected test case.

Parameters:
  • case_id (int) – PK of a TestCase object
  • comment (str) – The text to add as a comment
  • kwargs – Dict providing access to the current request, protocol entry point name and handler instance from the rpc method
Raises:

PermissionDenied – if missing django_comments.add_comment permission

Important

In webUI comments are only shown only during test case review!

tcms.rpc.api.testcase.remove_comment(case_id, comment_id=None)[source]
TestCase.remove_comment(case_id, comment_id)

Remove all or specified comment(s) from selected test case.

Parameters:
  • case_id (int) – PK of a TestCase object
  • comment_id (int) – PK of a Comment object or None
Raises:

PermissionDenied – if missing django_comments.delete_comment permission

tcms.rpc.api.testcase.add_component(case_id, component)[source]
XML-RPC TestCase.add_component(case_id, component)

Add component to the selected test case.

Parameters:
  • case_id (int) – PK of TestCase to modify
  • component (str) – Name of Component to add
Returns:

Serialized tcms.testcases.models.TestCase object

Return type:

dict

Raises:
  • PermissionDenied – if missing the testcases.add_testcasecomponent permission
  • DoesNotExist – if missing test case or component that match the specified PKs
tcms.rpc.api.testcase.get_components(case_id)[source]
XML-RPC TestCase.get_components(case_id)

Get the list of components attached to this case.

Parameters:case_id (int) – PK if TestCase
Returns:Serialized list of tcms.management.models.Component objects
Return type:list(dict)
Raises:TestCase.DoesNotExist if missing test case matching PK
tcms.rpc.api.testcase.remove_component(case_id, component_id)[source]
XML-RPC TestCase.remove_component(case_id, component_id)

Remove selected component from the selected test case.

Parameters:
  • case_id (int) – PK of TestCase to modify
  • component_id (int) – PK of Component to remove
Raises:
  • PermissionDenied – if missing the testcases.delete_testcasecomponent permission
  • DoesNotExist – if missing test case or component that match the specified PKs
tcms.rpc.api.testcase.add_notification_cc(case_id, cc_list)[source]
XML-RPC TestCase.add_notification_cc(case_id, cc_list)

Add email addresses to the notification list of specified TestCase

Parameters:
  • case_id (int) – PK of TestCase to be modified
  • cc_list (list(str)) – List of email addresses
Raises:
  • TypeError or ValidationError – if email validation fails
  • PermissionDenied – if missing testcases.change_testcase permission
  • TestCase.DoesNotExist – if object with case_id doesn’t exist
tcms.rpc.api.testcase.get_notification_cc(case_id)[source]
XML-RPC TestCase.get_notification_cc(case_id)

Return notification list for specified TestCase

Parameters:case_id (int) – PK of TestCase
Returns:List of email addresses
Return type:list(str)
Raises:TestCase.DoesNotExist if object with case_id doesn’t exist
tcms.rpc.api.testcase.remove_notification_cc(case_id, cc_list)[source]
XML-RPC TestCase.remove_notification_cc(case_id, cc_list)

Remove email addresses from the notification list of specified TestCase

Parameters:
  • case_id (int) – PK of TestCase to modify
  • cc_list (list(str)) – List of email addresses
Raises:
  • TypeError or ValidationError – if email validation fails
  • PermissionDenied – if missing testcases.change_testcase permission
  • TestCase.DoesNotExist – if object with case_id doesn’t exist
tcms.rpc.api.testcase.add_tag(case_id, tag, **kwargs)[source]
XML-RPC TestCase.add_tag(case_id, tag)

Add one tag to the specified test case.

Parameters:
  • case_id (int) – PK of TestCase to modify
  • tag (str) – Tag name to add
  • kwargs – Dict providing access to the current request, protocol entry point name and handler instance from the rpc method
Raises:
  • PermissionDenied – if missing testcases.add_testcasetag permission
  • TestCase.DoesNotExist – if object specified by PK doesn’t exist
  • Tag.DoesNotExist – if missing management.add_tag permission and tag doesn’t exist in the database!
tcms.rpc.api.testcase.remove_tag(case_id, tag)[source]
XML-RPC TestCase.remove_tag(case_id, tag)

Remove tag from a test case.

Parameters:
  • case_id (int) – PK of TestCase to modify
  • tag (str) – Tag name to remove
Raises:
  • PermissionDenied – if missing testcases.delete_testcasetag permission
  • DoesNotExist – if objects specified don’t exist
tcms.rpc.api.testcase.add_attachment(case_id, filename, b64content, **kwargs)[source]
XML-RPC TestCase.add_attachment(case_id, filename, b64content)

Add attachment to the given TestCase.

Parameters:
  • case_id (int) – PK of TestCase
  • filename (str) – File name of attachment, e.g. ‘logs.txt’
  • b64content (str) – Base64 encoded content
  • kwargs – Dict providing access to the current request, protocol entry point name and handler instance from the rpc method
tcms.rpc.api.testcase.list_attachments(case_id, **kwargs)[source]
XML-RPC TestCase.list_attachments(case_id)

List attachments for the given TestCase.

Parameters:
  • case_id (int) – PK of TestCase to inspect
  • kwargs – Dict providing access to the current request, protocol entry point name and handler instance from the rpc method
Returns:

A list containing information and download URLs for attachements

Return type:

list

Raises:

TestCase.DoesNotExit if object specified by PK is missing