tcms.rpc.api.testplan module

tcms.rpc.api.testplan.add_attachment(plan_id, filename, b64content, **kwargs)[source]
RPC TestPlan.add_attachment(plan_id, filename, b64content)

Add attachment to the given TestPlan.

Parameters:
  • plan_id (int) – PK of TestPlan

  • 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.testplan.add_case(plan_id, case_id)[source]
RPC TestPlan.add_case(plan_id, case_id)

Link test case to the given plan.

Parameters:
  • plan_id (int) – PK of TestPlan to modify

  • case_id (int) – PK of TestCase to be added to plan

Returns:

Serialized tcms.testcases.models.TestCase object augmented with a ‘sortkey’ value

Return type:

dict

Raises:
  • TestPlan.DoesNotExit or TestCase.DoesNotExist – if objects specified by PKs are missing

  • PermissionDenied – if missing testcases.add_testcaseplan permission

tcms.rpc.api.testplan.add_tag(plan_id, tag_name, **kwargs)[source]
RPC TestPlan.add_tag(plan_id, tag_name)

Add a tag to the specified test plan.

Parameters:
  • plan_id (int) – PK of TestPlan to modify

  • tag_name (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 testplans.add_testplantag permission

  • TestPlan.DoesNotExist – if object specified by PK doesn’t exist

  • Tag.DoesNotExist – if missing management.add_tag permission and tag_name doesn’t exist in the database!

tcms.rpc.api.testplan.create(values, **kwargs)[source]
RPC TestPlan.create(values)

Create new Test Plan object and store it in the database.

Parameters:
  • values (dict) – Field values for tcms.testplans.models.TestPlan

  • **kwargs – Dict providing access to the current request, protocol, entry point name and handler instance from the rpc method

Returns:

Serialized tcms.testplans.models.TestPlan object

Return type:

dict

Raises:
  • PermissionDenied – if missing testplans.add_testplan permission

  • ValueError – if data validation fails

Minimal parameters:

>>> values = {
    'product': 61,
    'product_version': 93,
    'name': 'Testplan foobar',
    'type': 1,
    'parent': 150,
    'text':'Testing TCMS',
}
>>> TestPlan.create(values)
tcms.rpc.api.testplan.filter(query=None)[source]
RPC TestPlan.filter(query)

Perform a search and return the resulting list of test plans.

Parameters:

query (dict) – Field lookups for tcms.testplans.models.TestPlan

Returns:

List of serialized tcms.testplans.models.TestPlan objects

Return type:

list(dict)

tcms.rpc.api.testplan.list_attachments(plan_id, **kwargs)[source]
RPC TestPlan.list_attachments(plan_id)

List attachments for the given TestPlan.

Parameters:
  • plan_id (int) – PK of TestPlan 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:

TestPlan.DoesNotExit – if object specified by PK is missing

tcms.rpc.api.testplan.remove_case(plan_id, case_id)[source]
RPC TestPlan.remove_case(plan_id, case_id)

Unlink a test case from the given plan.

Parameters:
  • plan_id (int) – PK of TestPlan to modify

  • case_id (int) – PK of TestCase to be removed from plan

Raises:

PermissionDenied – if missing testcases.delete_testcaseplan permission

tcms.rpc.api.testplan.remove_tag(plan_id, tag_name)[source]
RPC TestPlan.remove_tag(plan_id, tag_name)

Remove tag from the specified test plan.

Parameters:
  • plan_id (int) – PK of TestPlan to modify

  • tag_name (str) – Tag name to remove

Raises:
  • PermissionDenied – if missing testplans.delete_testplantag permission

  • DoesNotExist – if objects specified don’t exist

tcms.rpc.api.testplan.tree(plan_id)[source]
RPC TestPlan.tree(plan_id)

Returns a list of the ancestry tree for the given TestPlan in a depth-first order!

Parameters:

plan_id (int) – PK of TestPlan to inspect

Returns:

A DFS ordered list of all test plans in the family tree starting from the root of the tree

Return type:

list

Raises:

TestPlan.DoesNotExit – if object specified by PK is missing

tcms.rpc.api.testplan.update(plan_id, values)[source]
RPC TestPlan.update(plan_id, values)

Update the fields of the selected test plan.

Parameters:
Returns:

Serialized tcms.testplans.models.TestPlan object

Return type:

dict

Raises:
  • TestPlan.DoesNotExist – if object specified by PK doesn’t exist

  • PermissionDenied – if missing testplans.change_testplan permission

  • ValueError – if validations fail

tcms.rpc.api.testplan.update_case_order(plan_id, case_id, sortkey)[source]
RPC TestPlan.update_case_order(plan_id, case_id, sortkey)

Update sortkey which controls display order of the given test case in the given test plan.

Parameters:
  • plan_id (int) – PK of TestPlan holding the selected TestCase

  • case_id (int) – PK of TestCase to be modified

  • sortkey (int) – Ordering value, e.g. 10, 20, 30

Raises:

PermissionDenied – if missing testcases.delete_testcaseplan permission