tcms.rpc.api.testcase module

tcms.rpc.api.testcase.add_attachment(case_id, filename, b64content, **kwargs)[source]
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.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
Returns:

Serialized django_comments.models.Comment object

Return type:

dict

Raises:
  • PermissionDenied – if missing django_comments.add_comment permission
  • TestCase.DoesNotExist – if object specified by PK is missing

Important

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

tcms.rpc.api.testcase.add_component(case_id, component)[source]
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.management.models.Component 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.add_notification_cc(case_id, cc_list)[source]
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.add_property(case_id, name, value)[source]
TestCase.add_property(case_id, name, value)

Add property to test case! Duplicates are skipped without errors.

Parameters:
Returns:

Serialized tcms.testcases.models.Property object.

Return type:

dict

Raises:

PermissionDenied – if missing testcases.add_property permission

tcms.rpc.api.testcase.add_tag(case_id, tag, **kwargs)[source]
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.comments(case_id)[source]
TestCase.comments(case_id)

Return all comment(s) for the specified test case.

Parameters:

case_id (int) – PK of a TestCase object

Returns:

Serialized list of django_comments.models.Comment objects

Return type:

list

Raises:
  • PermissionDenied – if missing django_comments.view_comment permission
  • TestCase.DoesNotExist – if object specified by PK is missing
tcms.rpc.api.testcase.create(values, **kwargs)[source]
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.filter(query=None)[source]
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.get_notification_cc(case_id)[source]
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.history(case_id, query=None)[source]
RPC TestCase.history(case_id, query)

Return the history for a specified test case.

Parameters:
Returns:

Serialized list of HistoricalTestCase objects.

Return type:

list(dict)

tcms.rpc.api.testcase.list_attachments(case_id, **kwargs)[source]
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.DoesNotExist – if object specified by PK is missing

tcms.rpc.api.testcase.properties(query=None)[source]
TestCase.properties(query)

Return all properties for the specified test case(s).

Parameters:query (dict) – Field lookups for tcms.testcases.models.Property
Returns:Serialized list of tcms.testcases.models.Property objects.
Return type:list(dict)
Raises:PermissionDenied – if missing testcases.view_property permission
tcms.rpc.api.testcase.remove(query)[source]
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.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
  • TestCase.DoesNotExist – if object specified by PK is missing
tcms.rpc.api.testcase.remove_component(case_id, component_id)[source]
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.remove_notification_cc(case_id, cc_list)[source]
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.remove_property(query)[source]
TestCase.remove_property(query)

Remove selected properties.

Parameters:query (dict) – Field lookups for tcms.testcases.models.Property
Raises:PermissionDenied – if missing testcases.delete_property permission
tcms.rpc.api.testcase.remove_tag(case_id, tag)[source]
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.sortkeys(query=None)[source]
RPC TestCase.sortkeys(query)

Return information about TestCase position inside TestPlan.

For example TestCase.sortkeys({‘plan’: 3})

Parameters:query (dict) – Field lookups for tcms.testcases.models.TestCasePlan
Returns:Dictionary of (case_id, sortkey) pairs!
Return type:dict(case_id, sortkey)
tcms.rpc.api.testcase.update(case_id, values)[source]
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